Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var simpleData = function (data)
- {
- var that = {};
- // Decorators should always hold a simpleData instance, as you can nest instances
- // we do checking here rather than in every decorator
- if (typeof data.set === 'function')
- {
- return data;
- }
- // PRIVATE METHODS
- // ################################################
- // PUBLIC
- // ################################################
- that.set = function(candidate)
- {
- data = candidate;
- // if changed etc here...
- $(that).trigger('change');
- }
- that.get = function()
- {
- return data;
- }
- // INIT
- // ################################################
- return that;
- }
Add Comment
Please, Sign In to add comment