mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-31 17:38:48 +00:00
react app
This commit is contained in:
96
react-app/node_modules/react/lib/CallbackQueue.js
generated
vendored
Normal file
96
react-app/node_modules/react/lib/CallbackQueue.js
generated
vendored
Normal file
@@ -0,0 +1,96 @@
|
||||
/**
|
||||
* Copyright 2013-2015, Facebook, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This source code is licensed under the BSD-style license found in the
|
||||
* LICENSE file in the root directory of this source tree. An additional grant
|
||||
* of patent rights can be found in the PATENTS file in the same directory.
|
||||
*
|
||||
* @providesModule CallbackQueue
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
var PooledClass = require("./PooledClass");
|
||||
|
||||
var assign = require("./Object.assign");
|
||||
var invariant = require("./invariant");
|
||||
|
||||
/**
|
||||
* A specialized pseudo-event module to help keep track of components waiting to
|
||||
* be notified when their DOM representations are available for use.
|
||||
*
|
||||
* This implements `PooledClass`, so you should never need to instantiate this.
|
||||
* Instead, use `CallbackQueue.getPooled()`.
|
||||
*
|
||||
* @class ReactMountReady
|
||||
* @implements PooledClass
|
||||
* @internal
|
||||
*/
|
||||
function CallbackQueue() {
|
||||
this._callbacks = null;
|
||||
this._contexts = null;
|
||||
}
|
||||
|
||||
assign(CallbackQueue.prototype, {
|
||||
|
||||
/**
|
||||
* Enqueues a callback to be invoked when `notifyAll` is invoked.
|
||||
*
|
||||
* @param {function} callback Invoked when `notifyAll` is invoked.
|
||||
* @param {?object} context Context to call `callback` with.
|
||||
* @internal
|
||||
*/
|
||||
enqueue: function(callback, context) {
|
||||
this._callbacks = this._callbacks || [];
|
||||
this._contexts = this._contexts || [];
|
||||
this._callbacks.push(callback);
|
||||
this._contexts.push(context);
|
||||
},
|
||||
|
||||
/**
|
||||
* Invokes all enqueued callbacks and clears the queue. This is invoked after
|
||||
* the DOM representation of a component has been created or updated.
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
notifyAll: function() {
|
||||
var callbacks = this._callbacks;
|
||||
var contexts = this._contexts;
|
||||
if (callbacks) {
|
||||
("production" !== process.env.NODE_ENV ? invariant(
|
||||
callbacks.length === contexts.length,
|
||||
'Mismatched list of contexts in callback queue'
|
||||
) : invariant(callbacks.length === contexts.length));
|
||||
this._callbacks = null;
|
||||
this._contexts = null;
|
||||
for (var i = 0, l = callbacks.length; i < l; i++) {
|
||||
callbacks[i].call(contexts[i]);
|
||||
}
|
||||
callbacks.length = 0;
|
||||
contexts.length = 0;
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Resets the internal queue.
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
reset: function() {
|
||||
this._callbacks = null;
|
||||
this._contexts = null;
|
||||
},
|
||||
|
||||
/**
|
||||
* `PooledClass` looks for this.
|
||||
*/
|
||||
destructor: function() {
|
||||
this.reset();
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
PooledClass.addPoolingTo(CallbackQueue);
|
||||
|
||||
module.exports = CallbackQueue;
|
Reference in New Issue
Block a user