40 lines
1.8 KiB
JavaScript
40 lines
1.8 KiB
JavaScript
goog.provide("goog.debug.EntryPointMonitor");
|
|
goog.provide("goog.debug.entryPointRegistry");
|
|
goog.require("goog.asserts");
|
|
goog.debug.entryPointRegistry.EntryPointMonitor = function() {
|
|
};
|
|
goog.debug.entryPointRegistry.EntryPointMonitor.prototype.wrap;
|
|
goog.debug.entryPointRegistry.EntryPointMonitor.prototype.unwrap;
|
|
goog.debug.EntryPointMonitor = goog.debug.entryPointRegistry.EntryPointMonitor;
|
|
goog.debug.entryPointRegistry.refList_ = [];
|
|
goog.debug.entryPointRegistry.monitors_ = [];
|
|
goog.debug.entryPointRegistry.monitorsMayExist_ = false;
|
|
goog.debug.entryPointRegistry.register = function(callback) {
|
|
goog.debug.entryPointRegistry.refList_[goog.debug.entryPointRegistry.refList_.length] = callback;
|
|
if (goog.debug.entryPointRegistry.monitorsMayExist_) {
|
|
var monitors = goog.debug.entryPointRegistry.monitors_;
|
|
for (var i = 0; i < monitors.length; i++) {
|
|
callback(goog.bind(monitors[i].wrap, monitors[i]));
|
|
}
|
|
}
|
|
};
|
|
goog.debug.entryPointRegistry.monitorAll = function(monitor) {
|
|
goog.debug.entryPointRegistry.monitorsMayExist_ = true;
|
|
var transformer = goog.bind(monitor.wrap, monitor);
|
|
for (var i = 0; i < goog.debug.entryPointRegistry.refList_.length; i++) {
|
|
goog.debug.entryPointRegistry.refList_[i](transformer);
|
|
}
|
|
goog.debug.entryPointRegistry.monitors_.push(monitor);
|
|
};
|
|
goog.debug.entryPointRegistry.unmonitorAllIfPossible = function(monitor) {
|
|
var monitors = goog.debug.entryPointRegistry.monitors_;
|
|
goog.asserts.assert(monitor == monitors[monitors.length - 1], "Only the most recent monitor can be unwrapped.");
|
|
var transformer = goog.bind(monitor.unwrap, monitor);
|
|
for (var i = 0; i < goog.debug.entryPointRegistry.refList_.length; i++) {
|
|
goog.debug.entryPointRegistry.refList_[i](transformer);
|
|
}
|
|
monitors.length--;
|
|
};
|
|
|
|
//# sourceMappingURL=goog.debug.entrypointregistry.js.map
|