Guest User

Untitled

a guest
Jul 18th, 2018
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.62 KB | None | 0 0
  1. var simpleData = function (data)
  2. {
  3. var that = {};
  4.  
  5. // Decorators should always hold a simpleData instance, as you can nest instances
  6. // we do checking here rather than in every decorator
  7. if (typeof data.set === 'function')
  8. {
  9. return data;
  10. }
  11.  
  12. // PRIVATE METHODS
  13. // ################################################
  14.  
  15.  
  16. // PUBLIC
  17. // ################################################
  18.  
  19. that.set = function(candidate)
  20. {
  21. data = candidate;
  22.  
  23. // if changed etc here...
  24. $(that).trigger('change');
  25. }
  26.  
  27. that.get = function()
  28. {
  29. return data;
  30. }
  31.  
  32. // INIT
  33. // ################################################
  34.  
  35. return that;
  36. }
Add Comment
Please, Sign In to add comment