Created
June 30, 2010 22:13
Revisions
-
lsmith revised this gist
Jul 1, 2010 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -62,7 +62,7 @@ Y.Plugin.NodeIO = Y.Base.create('node-io', Y.Plugin.Base, [], { placement : { value : 'replace', validator : function(val){ return /^(?:replace|(?:ap|pre)pend)$/.test(val); } }, -
lsmith renamed this gist
Jul 1, 2010 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes. -
lsmith revised this gist
Jul 1, 2010 . 1 changed file with 4 additions and 1 deletion.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -71,4 +71,7 @@ Y.Plugin.NodeIO = Y.Base.create('node-io', Y.Plugin.Base, [], { validator: Y.Lang.isObject } } }); // Sugar coated alias Y.Plugin.NodeIO.prototype.refresh = Y.Plugin.NodeIO.prototype.load; -
lsmith created this gist
Jun 30, 2010 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,74 @@ Y.Plugin.NodeIO = Y.Base.create('node-io', Y.Plugin.Base, [], { _inProgress: null, _ioHandlers: null, initializer: function () { this.publish("success", { defaultFn: this._defSuccessFn }); this.after('uriChange', this._afterUriChange); this._ioHandlers = { success: Y.bind(this._handleResponse, this, "success"), failure: Y.bind(this._handleResponse, this, "failure"), timeout: Y.bind(this._handleResponse, this, "timeout") }; }, load : function(uri) { var config = this.get("ioConfig"); uri || (uri = this.get('uri')); this.set('uri', uri); config.on = this._ioHandlers; this._inProgress = Y.io(this.get('uri'), ioConfig); return this; }, abort : function() { this._stopIO(); return this; }, _stopIO : function() { if (this._inProgress) { this._inProgress.abort(); this._inProgress = null; } }, _handleResponse: function (id, o, type) { this.fire(type, { id: id, response: o }); this._inProgress = null; }, _defSuccessFn : function(e) { this.get('host').insert(e.responseText, this.get('placement')); }, _afterUriChange: function () { this._stopIO(); } }, { NS : 'io', ATTRS : { uri : { validator: Y.Lang.isString }, placement : { value : 'replace', validator : function(val){ return /replace|(?:ap|pre)pend/.test(val); } }, ioConfig : { value: {}, validator: Y.Lang.isObject } } });