1
0
mirror of https://github.com/kkapsner/CanvasBlocker synced 2024-12-22 12:50:36 +01:00
CanvasBlocker/lib/modifiedAPI.js
2019-03-13 08:08:36 +01:00

43 lines
1.3 KiB
JavaScript

/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
(function(){
"use strict";
var scope;
if ((typeof exports) !== "undefined"){
scope = exports;
}
else {
scope = require.register("./modifiedAPI", {});
}
const randomSupplyCallbacks = [];
scope.setRandomSupply = function(supply){
randomSupplyCallbacks.forEach(function(callback){
callback(supply);
});
};
scope.changedFunctions = {};
scope.changedGetters = [];
function appendModified(collection){
if (collection.setRandomSupply){
randomSupplyCallbacks.push(collection.setRandomSupply);
}
Object.keys(collection.changedFunctions || {}).forEach(function(key){
scope.changedFunctions[key] = collection.changedFunctions[key];
});
(collection.changedGetters || []).forEach(function(changedGetter){
scope.changedGetters.push(changedGetter);
});
}
appendModified(require("./modifiedCanvasAPI"));
appendModified(require("./modifiedAudioAPI"));
appendModified(require("./modifiedHistoryAPI"));
appendModified(require("./modifiedWindowAPI"));
appendModified(require("./modifiedDOMRectAPI"));
appendModified(require("./modifiedNavigatorAPI"));
}());