Last active
December 14, 2015 01:49
-
-
Save jiggliemon/5009595 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var Obj = require('parsed/object') | |
var LocalStorage = require('parsed/object/localstorage') | |
var Validation = require('parsed/object/validation') | |
var Task = Obj.create('Task', { | |
implement: [LocalStorage, Validation] | |
}, { | |
init: function () { | |
} | |
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var LocalStorage = function () { | |
} | |
LocalStorage.prototype = { | |
listeners: { | |
'saved':'save' | |
}, | |
save: function (err, data) { | |
if (!err) | |
localStorageAllTheThings(data) | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var Validate = function () { | |
} | |
Validate.prototype = { | |
listeners: { | |
'data.set':'validate' | |
'init': 'setup' | |
}, | |
setup: function () { | |
}, | |
validate: function (key, data) { | |
if (this.rules[key]) { | |
// somehow validate this junk. | |
// otherwise throw an error? | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Then in init i would do: