单例模式

function singleton ( fn ){
  var result;
  return function(){
      return result || ( result = fn .apply( this, arguments ) );
  }
}

  单例模式。

原文地址:https://www.cnblogs.com/rainbow661314/p/13153313.html