Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var sortableData = function (data)
- {
- var that = {},
- _super,
- _data;
- // PRIVATE METHODS
- // ################################################
- function _onChange(newData)
- {
- _data = newData + ' sorted';
- return _data;
- }
- // PUBLIC
- // ################################################
- that.set = function(x)
- {
- // set our simpleData, if it changes our onChange will finish it off
- _super.set(x);
- }
- that.get = function()
- {
- return _data;
- }
- // INIT
- // ################################################
- // always keep a simpleData instance
- _super = simpleData(data);
- // when the simpleData instance changes we process it and store it
- _data = _onChange(_super.get());
- // re-process our data whenever the simpleData instance changes
- $(_super).bind('change', function()
- {
- _onChange(_super.get());
- });
- return that;
- }
Add Comment
Please, Sign In to add comment