Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
Download
81152 views
1
/**
2
* Copyright 2013-2014, Facebook, Inc.
3
* All rights reserved.
4
*
5
* This source code is licensed under the BSD-style license found in the
6
* LICENSE file in the root directory of this source tree. An additional grant
7
* of patent rights can be found in the PATENTS file in the same directory.
8
*
9
* @providesModule ReactPutListenerQueue
10
*/
11
12
"use strict";
13
14
var PooledClass = require('PooledClass');
15
var ReactBrowserEventEmitter = require('ReactBrowserEventEmitter');
16
17
var assign = require('Object.assign');
18
19
function ReactPutListenerQueue() {
20
this.listenersToPut = [];
21
}
22
23
assign(ReactPutListenerQueue.prototype, {
24
enqueuePutListener: function(rootNodeID, propKey, propValue) {
25
this.listenersToPut.push({
26
rootNodeID: rootNodeID,
27
propKey: propKey,
28
propValue: propValue
29
});
30
},
31
32
putListeners: function() {
33
for (var i = 0; i < this.listenersToPut.length; i++) {
34
var listenerToPut = this.listenersToPut[i];
35
ReactBrowserEventEmitter.putListener(
36
listenerToPut.rootNodeID,
37
listenerToPut.propKey,
38
listenerToPut.propValue
39
);
40
}
41
},
42
43
reset: function() {
44
this.listenersToPut.length = 0;
45
},
46
47
destructor: function() {
48
this.reset();
49
}
50
});
51
52
PooledClass.addPoolingTo(ReactPutListenerQueue);
53
54
module.exports = ReactPutListenerQueue;
55
56