Created
December 15, 2010 00:58
-
-
Save erichocean/741440 to your computer and use it in GitHub Desktop.
proof-of-concept: allows you to write <key>Update: functions instead of putting all your code inside update()
This file contains hidden or 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
// Add this to your custom view or render delegate (see comment below for the rest). | |
update: function(jquery) { | |
var fn, key, displayProperties = this.getChangedDisplayProperties() ; | |
for (key in displayProperties) { | |
if (!displayProperties.hasOwnProperty(key)) continue ; | |
if (fn = this[key+'Update']) fn.call(this, jquery, displayProperties[key]) ; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Example usage:
displayProperties: 'title value'.w(),$, val) { $ .find('.title').text(val); },$, val) { $ .find('.value').text(val); }
titleUpdate: function(
valueUpdate: function(