/ Published in: JavaScript
Config is a utility used within an Object to allow the implementer to maintain a list of local configuration properties and listen for changes to those properties dynamically using CustomEvent. The initial values are also maintained so that the configuration can be reset at any given point to its initial state.
Dependencies: * yahoo.js * event.js
Expand |
Embed | Plain Text
// JScript source code var Object = function(){ var cfg = new YAHOO.util.Config(this); element; initDefaultConfig: function() { this.cfg.addProperty( "color", { value: "#000000", handler: setColor } ); this.cfg.addProperty( "width", { value: null, handler: setWidth } ); this.cfg.fireQueue(); } var setColor = function(type, args, obj){ var color = args[0]; YAHOO.util.Dom.setStyle(element, "color", color); } var setWidth = function(type, args, obj){ var width = args[0] + "px"; YAHOO.util.Dom.setStyle(element, "width", width); } this.init = function(elementId){ element = YAHOO.util.Dom.get(elementId); initDefaultConfig(); } };
Comments
Subscribe to comments
You need to login to post a comment.

This is my post.. I can't seem to find the edit post option anywhere... HELP?
It should be on the side under "Snippet Actions" when you are viewing the snippet.