Skip to content

Commit

Permalink
Merge pull request #819 from enyojs/ENYO-43
Browse files Browse the repository at this point in the history
ENYO-43: Re-review Enyo docs

Reviewed-By: Cole Davis (cole.davis@lge.com)
  • Loading branch information
clinuz committed Aug 1, 2014
2 parents d4fb829 + 6ec7fac commit 1f150fd
Show file tree
Hide file tree
Showing 80 changed files with 689 additions and 670 deletions.
32 changes: 16 additions & 16 deletions source/ajax/Ajax.js
Expand Up @@ -49,7 +49,7 @@
* @private
*/
constructor: enyo.inherit(function (sup) {
return function(inParams) {
return function (inParams) {
enyo.mixin(this, inParams);
sup.apply(this, arguments);
};
Expand All @@ -59,7 +59,7 @@
* @private
*/
destroy: enyo.inherit(function (sup) {
return function() {
return function () {
// explicilty release any XHR refs
this.xhr = null;
sup.apply(this, arguments);
Expand Down Expand Up @@ -94,12 +94,12 @@
* @see enyo.AjaxProperties
* @see enyo.Ajax#xhrResponse
* @see enyo.Ajax~xhrResponse
* @param {(Object|String)} [params] A [string]{@glossary String} or
* @param {(Object|String)} [params] - A [string]{@glossary String} or
* [hash]{@glossary Object} to be used as the query string.
* @returns {this} The callee for chaining.
* @public
*/
go: function(params) {
go: function (params) {
this.failed = false;
this.startTimer();
this.request(params);
Expand All @@ -109,7 +109,7 @@
/**
* @private
*/
request: function(params) {
request: function (params) {
var parts = this.url.split('?');
var uri = parts.shift() || '';
var args = parts.length ? (parts.join('?').split('&')) : [];
Expand Down Expand Up @@ -196,7 +196,7 @@
/**
* @private
*/
receive: function(inText, inXhr) {
receive: function (inText, inXhr) {
if (!this.failed && !this.destroyed) {
var body;
if (inXhr.responseType === 'arraybuffer') {
Expand Down Expand Up @@ -224,7 +224,7 @@
* @private
*/
fail: enyo.inherit(function (sup) {
return function(inError) {
return function (inError) {
// on failure, explicitly cancel the XHR to prevent
// further responses. cancellation also resets the
// response headers & body,
Expand All @@ -239,7 +239,7 @@
/**
* @private
*/
xhrToResponse: function(inXhr) {
xhrToResponse: function (inXhr) {
if (inXhr) {
return this[(this.handleAs || 'text') + 'Handler'](inXhr);
}
Expand All @@ -248,7 +248,7 @@
/**
* @private
*/
isFailure: function(inXhr) {
isFailure: function (inXhr) {
// if any exceptions are thrown while checking fields in the xhr,
// assume a failure.
try {
Expand Down Expand Up @@ -285,21 +285,21 @@
/**
* @private
*/
xmlHandler: function(inXhr) {
xmlHandler: function (inXhr) {
return inXhr.responseXML;
},

/**
* @private
*/
textHandler: function(inXhr) {
textHandler: function (inXhr) {
return inXhr.responseText;
},

/**
* @private
*/
jsonHandler: function(inXhr) {
jsonHandler: function (inXhr) {
var r = inXhr.responseText;
try {
return r && enyo.json.parse(r);
Expand All @@ -312,14 +312,14 @@
/**
* @private
*/
binaryHandler: function(inXhr) {
binaryHandler: function (inXhr) {
return inXhr.response;
},

/**
* @private
*/
updateProgress: function(event) {
updateProgress: function (event) {
// filter out 'input' as it causes exceptions on some Firefox versions
// due to unimplemented internal APIs
var ev = {};
Expand All @@ -335,7 +335,7 @@
* @private
*/
statics: {
objectToQuery: function(/*Object*/ map) {
objectToQuery: function (/*Object*/ map) {
var enc = encodeURIComponent;
var pairs = [];
var backstop = {};
Expand All @@ -360,7 +360,7 @@
* @private
*/
protectedStatics: {
parseResponseHeaders: function(xhr) {
parseResponseHeaders: function (xhr) {
var headers = {};
var headersStr = [];
if (xhr.getAllResponseHeaders) {
Expand Down
16 changes: 8 additions & 8 deletions source/ajax/Async.js
Expand Up @@ -119,8 +119,8 @@
* [execution]{@link enyo.Async#go} is completed successfully. Parameters may be
* in any order, to preserve backward compatibility.
*
* @param {Function} fn The callback to register.
* @param {Object} [ctx] The optional context under which to execute the callback.
* @param {Function} fn - The callback to register.
* @param {Object} [ctx] - The optional context under which to execute the callback.
* @returns {this} The callee for chaining.
* @public
*/
Expand All @@ -134,8 +134,8 @@
* [execution]{@link enyo.Async#go} completes with an error. Parameters may be
* in any order, to preserve backward compatibility.
*
* @param {Function} fn The callback to register.
* @param {Object} [ctx] The optional context under which to execute the callback.
* @param {Function} fn - The callback to register.
* @param {Object} [ctx] - The optional context under which to execute the callback.
* @returns {this} The callee for chaining.
* @public
*/
Expand All @@ -148,8 +148,8 @@
* Registers a [function]{@glossary Function} to be fired on progress events.
* Parameters may be in any order, to preserve backward compatibility.
*
* @param {Function} fn The callback to register.
* @param {Object} [ctx] The optional context under which to execute the callback.
* @param {Function} fn - The callback to register.
* @param {Object} [ctx] - The optional context under which to execute the callback.
* @returns {this} The callee for chaining.
* @public
*/
Expand Down Expand Up @@ -237,7 +237,7 @@
* Fails the [task]{@link enyo.Async} and triggers the error chain. May be called from any
* handler.
*
* @param {*} err The error value to pass to error handlers.
* @param {*} err - The error value to pass to error handlers.
* @returns {this} The callee for chaining.
* @public
*/
Expand Down Expand Up @@ -280,7 +280,7 @@
* successfully. This method is usually overloaded in [subkinds]{@glossary subkind}.
*
* @virtual
* @param {*} value The value to pass to responders.
* @param {*} - value The value to pass to responders.
* @returns {this} The callee for chaining.
* @public
*/
Expand Down
2 changes: 1 addition & 1 deletion source/ajax/Jsonp.js
Expand Up @@ -146,7 +146,7 @@
* Initiates the asynchronous routine and will supply the given value if it completes
* successfully. Overloaded from [enyo.Async.go()]{@link enyo.Async#go}.
*
* @param {*} value The value to pass to responders.
* @param {*} value - The value to pass to responders.
* @returns {this} The callee for chaining.
* @public
*/
Expand Down
10 changes: 5 additions & 5 deletions source/ajax/WebService.js
Expand Up @@ -3,7 +3,7 @@
/**
* Fires when a response is received.
*
* @event enyo.WebService#event:onResponse
* @event enyo.WebService#onResponse
* @type {Object}
* @property {enyo.Async} ajax - The {@link enyo.Async} instance associated with the request.
* @property {*} data - Any response data associated with the request.
Expand All @@ -13,7 +13,7 @@
/**
* Fires when an error is received.
*
* @event enyo.WebService#event:onError
* @event enyo.WebService#onError
* @type {Object}
* @property {enyo.Async} ajax - The {@link enyo.Async} instance associated with the request.
* @property {*} data - Any response data associated with the request.
Expand All @@ -25,7 +25,7 @@
* [ProgressEvent]{@glossary ProgressEvent}.
*
* @see {@glossary ProgressEvent}
* @event enyo.WebService#event:onProgress
* @event enyo.WebService#onProgress
* @type {Object}
* @property {Boolean} lengthComputable - The read-only flag indicating whether the progress
* is computable.
Expand Down Expand Up @@ -147,8 +147,8 @@
* Sends an XHR request with the given parameters, returning the associated
* {@link enyo.Async} instance.
*
* @param {Object} params The parameters to pass to the request.
* @param {Object} [props] The optional properties to override the
* @param {Object} params - The parameters to pass to the request.
* @param {Object} [props] - The optional properties to override the
* {@link enyo.AjaxProperties} of the request.
* @returns {enyo.Async} The associated {@link enyo.Async} instance.
* @public
Expand Down
8 changes: 4 additions & 4 deletions source/ajax/cookie.js
Expand Up @@ -19,8 +19,8 @@
* Retrieves the given [cookie]{@glossary cookie} from
* [document.cookie]{@glossary document.cookie}.
*
* @param {String} nom The name of the cookie to retrieve.
* @returns {(String|undefined)} The [decoded]{@glossary decoreURIComponent} cookie, or
* @param {String} nom - The name of the cookie to retrieve.
* @returns {(String|undefined)} The [decoded]{@glossary decodeURIComponent} cookie, or
* `undefined` if it could not be retrieved.
* @public
*/
Expand All @@ -40,8 +40,8 @@
* application, Chrome must be started from the command line with the
* `--enable-file-cookies` switch to allow cookies to be set.
*
* @param {String} nom The name of the cookie.
* @param {*} value The value to be [encoded]{@glossary encodeURIComponent} for storage.
* @param {String} nom - The name of the cookie.
* @param {*} value - The value to be [encoded]{@glossary encodeURIComponent} for storage.
* @param {enyo~CookieProperties} [props] The optional configuration properties to apply to
* the cookie.
* @public
Expand Down
8 changes: 4 additions & 4 deletions source/ajax/json.js
Expand Up @@ -14,13 +14,13 @@
* [object]{@glossary Object}.
*
* @see {@glossary JSON.stringify}
* @param {Object} value The [object]{@glossary Object} to convert to a
* @param {Object} value - The [object]{@glossary Object} to convert to a
* [JSON]{@glossary JSON} [string]{@glossary String}.
* @param {(Function|String[])} [replacer] An optional parameter indicating either an
* [array]{@glossary Array} of keys to include in the final output or a
* [function]{@glossary Function} that will have the opportunity to dynamically return
* values to include for keys.
* @param {(Number|String)} [space] Determines the spacing (if any) for pretty-printed
* @param {(Number|String)} [space] - Determines the spacing (if any) for pretty-printed
* output of the JSON string. A [number]{@glossary Number} indicates the number of
* spaces to use in the output, while a string will be used verbatim.
* @returns {String} The JSON string for the given object.
Expand All @@ -36,9 +36,9 @@
* [object]{@glossary Object}, or `null` if the parameters are invalid.
*
* @see {@glossary JSON.parse}
* @param {String} json The [JSON]{@glossary JSON} [string]{@glossary String} to
* @param {String} json - The [JSON]{@glossary JSON} [string]{@glossary String} to
* parse into an [object]{@glossary Object}.
* @param {Function} [reviver] The optional [function]{@glossary Function} to use to
* @param {Function} [reviver] - The optional [function]{@glossary Function} to use to
* parse individual keys of the return object.
* @returns {(Object|null)} If parameters are valid, an [object]{@glossary Object}
* is returned; otherwise, `null`.
Expand Down
4 changes: 2 additions & 2 deletions source/ajax/xhr.js
Expand Up @@ -36,7 +36,7 @@
* cached. To disable this, use the `header` property to specify an object where
* `cache-control` is set to `null`.
*
* @param {enyo.xhr.request~Options} params The options and properties for this XHR request.
* @param {enyo.xhr.request~Options} params - The options and properties for this XHR request.
* @returns {XMLHttpRequest} The XHR request object.
* @private
*/
Expand Down Expand Up @@ -91,7 +91,7 @@
* Removes any callbacks that might be set from Enyo code for an existing XHR
* and stops the XHR from completing (if possible).
*
* @param {XMLHttpRequest} The request to cancel.
* @param {XMLHttpRequest} The - request to cancel.
* @private
*/
cancel: function (xhr) {
Expand Down
22 changes: 11 additions & 11 deletions source/boot/boot.js
Expand Up @@ -4,7 +4,7 @@
* @private
*/
enyo.machine = {
sheet: function(inPath) {
sheet: function (inPath) {
var type = 'text/css';
var rel = 'stylesheet';
var isLess = (inPath.slice(-5) == '.less');
Expand Down Expand Up @@ -36,13 +36,13 @@
if (isLess && window.less) {
window.less.sheets.push(link);
if (!enyo.loader.finishCallbacks.lessRefresh) {
enyo.loader.finishCallbacks.lessRefresh = function() {
enyo.loader.finishCallbacks.lessRefresh = function () {
window.less.refresh(true);
};
}
}
},
script: function(inSrc, onLoad, onError) {
script: function (inSrc, onLoad, onError) {
if (enyo.runtimeLoading) {
var script = document.createElement('script');
script.src = inSrc;
Expand All @@ -60,7 +60,7 @@
/* jshint evil: false */
}
},
inject: function(inCode) {
inject: function (inCode) {
/* jshint evil: true */
document.write('<scri' + 'pt type="text/javascript">' + inCode + '</scri' + 'pt>');
/* jshint evil: false */
Expand All @@ -79,7 +79,7 @@
*
* @private
*/
enyo.depends = function() {
enyo.depends = function () {
var ldr = enyo.loader;
if (!ldr.packageFolder) {
var tag = enyo.locateScript('package.js');
Expand All @@ -93,12 +93,12 @@
};

// Runtime loader
(function() {
(function () {
var enyo = window.enyo;
var runtimeLoadQueue = [];

var domLoaded = false;
enyo.ready(function() {
enyo.ready(function () {
domLoaded = true;
});

Expand All @@ -112,10 +112,10 @@
* @name enyo.load
* @method
* @param {(String|String[])} depends The path (or paths) to load.
* @param {Function} callback The callback to execute after the package has loaded.
* @param {Function} callback - The callback to execute after the package has loaded.
* @public
*/
enyo.load = function(depends, callback) {
enyo.load = function (depends, callback) {
if (domLoaded) {
runtimeLoadQueue.push(arguments);
if (!enyo.runtimeLoading) {
Expand Down Expand Up @@ -145,12 +145,12 @@
var depends = args[0];
var dependsArg = enyo.isArray(depends) ? depends : [depends];
var onLoadCallback = args[1];
enyo.loader.finishCallbacks.runtimeLoader = function(inBlock) {
enyo.loader.finishCallbacks.runtimeLoader = function (inBlock) {
// Once loader is done loading a package, we chain a call to runtimeLoad(),
// which will call the onLoadCallback from the original load call, passing
// a reference to the depends argument from the original call for tracking,
// followed by kicking off any additionally queued load() calls
runtimeLoad(function() {
runtimeLoad(function () {
if (onLoadCallback) {
onLoadCallback(inBlock);
}
Expand Down

0 comments on commit 1f150fd

Please sign in to comment.