Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(48)

Side by Side Diff: chrome/browser/resources/file_manager/js/metadata/function_sequence.js

Issue 12212187: [Cleanup] Files.app: Misc style fixes in Javascript code. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 /** 5 /**
6 * @constructor
7 * @class FunctionSequence to invoke steps in sequence 6 * @class FunctionSequence to invoke steps in sequence
8 * 7 *
9 * @param {string} name //TODO(JSDOC). 8 * @param {string} name //TODO(JSDOC).
10 * @param {Array} steps array of functions to invoke in sequence. 9 * @param {Array} steps array of functions to invoke in sequence.
11 * @param {Object} logger logger. 10 * @param {Object} logger logger.
12 * @param {Function} callback callback to invoke on success. 11 * @param {Function} callback callback to invoke on success.
13 * @param {Function} failureCallback callback to invoke on failure. 12 * @param {Function} failureCallback callback to invoke on failure.
13 * @constructor
14 */ 14 */
15 function FunctionSequence(name, steps, logger, callback, failureCallback) { 15 function FunctionSequence(name, steps, logger, callback, failureCallback) {
16 // Private variables hidden in closure 16 // Private variables hidden in closure
17 this.currentStepIdx_ = -1; 17 this.currentStepIdx_ = -1;
18 this.failed_ = false; 18 this.failed_ = false;
19 this.steps_ = steps; 19 this.steps_ = steps;
20 this.callback_ = callback; 20 this.callback_ = callback;
21 this.failureCallback_ = failureCallback; 21 this.failureCallback_ = failureCallback;
22 this.logger = logger; 22 this.logger = logger;
23 this.name = name; 23 this.name = name;
(...skipping 20 matching lines...) Expand all
44 */ 44 */
45 FunctionSequence.prototype.setFailureCallback = function(failureCallback) { 45 FunctionSequence.prototype.setFailureCallback = function(failureCallback) {
46 this.failureCallback_ = failureCallback; 46 this.failureCallback_ = failureCallback;
47 }; 47 };
48 48
49 49
50 /** 50 /**
51 * Error handling function, which traces current error step, stops sequence 51 * Error handling function, which traces current error step, stops sequence
52 * advancing and fires error callback. 52 * advancing and fires error callback.
53 * 53 *
54 * @param {string} err Error message 54 * @param {string} err Error message.
55 * @private 55 * @private
56 */ 56 */
57 FunctionSequence.prototype.onError_ = function(err) { 57 FunctionSequence.prototype.onError_ = function(err) {
58 this.logger.vlog('Failed step: ' + this.steps_[this.currentStepIdx_].name + 58 this.logger.vlog('Failed step: ' + this.steps_[this.currentStepIdx_].name +
59 ': ' + err); 59 ': ' + err);
60 if (!this.failed_) { 60 if (!this.failed_) {
61 this.failed_ = true; 61 this.failed_ = true;
62 this.failureCallback_(err); 62 this.failureCallback_(err);
63 } 63 }
64 }; 64 };
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
122 122
123 /** 123 /**
124 * Add Function object mimics to FunctionSequence 124 * Add Function object mimics to FunctionSequence
125 * @private 125 * @private
126 * @param {*} obj //TODO(JSDOC). 126 * @param {*} obj //TODO(JSDOC).
127 * @param {Array.*} args /TODO(JSDOC). 127 * @param {Array.*} args /TODO(JSDOC).
128 */ 128 */
129 FunctionSequence.prototype.apply_ = function(obj, args) { 129 FunctionSequence.prototype.apply_ = function(obj, args) {
130 this.start.apply(this, args); 130 this.start.apply(this, args);
131 }; 131 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698