Last active
December 18, 2015 08:59
-
-
Save dpobel/5758265 to your computer and use it in GitHub Desktop.
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
| YUI.add('ez-stuff', function (Y) { | |
| "use strict"; | |
| var L = Y.Lang, | |
| MY_CLASS = 'ez-stuff-renderer'; | |
| /** | |
| * Provides Y.eZ.Stuff | |
| * | |
| * @module ez-stuff | |
| * @class Y.eZ.Stuff | |
| */ | |
| Y.namespace('eZ'); | |
| function _doAnotherStuff(arr) { | |
| for (var i = 0; i <= arr.length; i++) { | |
| arr[i] = arr[i] + 1; | |
| } | |
| } | |
| Y.eZ.Stuff = Y.Base.create('stuffWidget', Y.Widget, [], { | |
| config: { | |
| fooBar: 'bar', | |
| ez: 'eZ Publish' | |
| }, | |
| /** | |
| * Initializes the application: | |
| * | |
| * - step 1 bla bla bla | |
| * - step 2 blab blbla | |
| * | |
| * @method initializer | |
| */ | |
| initializer: function () { | |
| this.on('ready', function (e) { | |
| if (e.target.stuff === this.get('config').foo) { | |
| this._doStuff(); | |
| } | |
| }); | |
| }, | |
| /** | |
| * Renders the widget | |
| * | |
| * @method render | |
| * @param node {Node|string} the Y.Node or a string selector to the node | |
| * used to render the widget | |
| */ | |
| render: function (node) { | |
| var cl = MY_CLASS.replace('foo', 'bar'); | |
| if (L.isString(node)) { | |
| node = Y.one(node); | |
| } | |
| node.addClass(cl); | |
| this._doStuff(); | |
| }, | |
| _doStuff: function () { | |
| _doAnotherStuff(); | |
| } | |
| }, { | |
| ATTRS: { | |
| /** | |
| * Store the value handled by blalbla | |
| * | |
| * @attribute foo | |
| * @default bar | |
| * @type string | |
| */ | |
| foo: { | |
| value: 'bar' | |
| } | |
| } | |
| }); | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment