1
0
mirror of https://github.com/kkapsner/CanvasBlocker synced 2024-12-23 05:10:27 +01:00
CanvasBlocker/lib/modifiedAPI.js
2019-11-28 01:26:35 +01:00

44 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";
let 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"));
appendModified(require("./modifiedScreenAPI"));
}());