daily pastebin goal
59%
SHARE
TWEET

Untitled

a guest Dec 11th, 2017 43 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // Свойства функции используются для создания коллекции из функций
  2. var store = {
  3.   nextId: 1,
  4.  
  5.   cache: {},
  6.  
  7.   add: function(fn) {
  8.     if( !fn.id ) {
  9.      
  10.       fn.id = this.nextId++;
  11.       this.cache[fn.id] = fn;
  12.      
  13.       console.log("Function was successfully added");
  14.      
  15.       return true;
  16.     }
  17.    
  18.     console.log("This function was already added to store.");
  19.   }
  20. };
  21.  
  22. function ninja() {}
  23.  
  24. store.add(ninja);
  25. store.add(ninja);
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top