Advertisement
Guest User

Untitled

a guest
Oct 7th, 2017
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. var Singleton, ns;
  2. var __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; };
  3. ns = {};
  4. Singleton = (function() {
  5.   function Singleton() {
  6.     Singleton = __bind(function() {
  7.       return this;
  8.     }, this);
  9.   }
  10.   return Singleton;
  11. })();
  12. alert(new Singleton === new Singleton);
  13. ns.Singleton = (function() {
  14.   function Singleton() {
  15.     ns.Singleton = __bind(function() {
  16.       return this;
  17.     }, this);
  18.   }
  19.   return Singleton;
  20. })();
  21. alert(new ns.Singleton === new ns.Singleton);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement