31 lines
614 B
JavaScript
31 lines
614 B
JavaScript
|
|
/**
|
||
|
|
* Copyright (c) 2016-present, Facebook, Inc.
|
||
|
|
*
|
||
|
|
* This source code is licensed under the MIT license found in the
|
||
|
|
* LICENSE file in the root directory of this source tree.
|
||
|
|
*
|
||
|
|
*
|
||
|
|
*/
|
||
|
|
|
||
|
|
'use strict';
|
||
|
|
|
||
|
|
var history = [];
|
||
|
|
|
||
|
|
var ReactHostOperationHistoryHook = {
|
||
|
|
onHostOperation: function (operation) {
|
||
|
|
history.push(operation);
|
||
|
|
},
|
||
|
|
clearHistory: function () {
|
||
|
|
if (ReactHostOperationHistoryHook._preventClearing) {
|
||
|
|
// Should only be used for tests.
|
||
|
|
return;
|
||
|
|
}
|
||
|
|
|
||
|
|
history = [];
|
||
|
|
},
|
||
|
|
getHistory: function () {
|
||
|
|
return history;
|
||
|
|
}
|
||
|
|
};
|
||
|
|
|
||
|
|
module.exports = ReactHostOperationHistoryHook;
|