1
0
mirror of https://github.com/kkapsner/CanvasBlocker synced 2024-11-04 20:28:52 +01:00
CanvasBlocker/lib/modifiedAPI.js
2020-03-14 12:54:23 +01:00

45 lines
1.4 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("./modifiedTextMetricsAPI"));
appendModified(require("./modifiedNavigatorAPI"));
appendModified(require("./modifiedScreenAPI"));
}());