1
0
Fork 0
mirror of https://github.com/kkapsner/CanvasBlocker synced 2025-07-04 20:46:39 +02:00

Cleanup require system

This commit is contained in:
kkapsner 2019-03-12 22:24:23 +01:00
parent 11b8ddfcc8
commit 574efa23e7
35 changed files with 45 additions and 67 deletions

View file

@ -8,8 +8,7 @@
scope = exports;
}
else {
window.scope.askForPermission = {};
scope = window.scope.askForPermission;
scope = require.register("./askForPermission", {});
}
const {parseErrorStack} = require("./callingStack");

View file

@ -9,8 +9,7 @@
scope = exports;
}
else {
window.scope.callingStack = {};
scope = window.scope.callingStack;
scope = require.register("./callingStack", {});
}
const settings = require("./settings");

View file

@ -9,8 +9,7 @@
scope = exports;
}
else {
window.scope.check = {};
scope = window.scope.check;
scope = require.register("./check", {});
}
const settings = require("./settings");

View file

@ -10,8 +10,7 @@
scope = exports;
}
else {
window.scope.colorStatistics = {};
scope = window.scope.colorStatistics;
scope = require.register("./colorStatistics", {});
}
class Statistic{

View file

@ -9,8 +9,7 @@
scope = exports;
}
else {
window.scope.dataUrls = {};
scope = window.scope.dataUrls;
scope = require.register("./dataUrls", {});
}
const logging = require("./logging");

View file

@ -1,7 +1,7 @@
/* 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(){
(function(require){
"use strict";
const settings = require("./settings");
@ -171,4 +171,4 @@
});
interceptWindow(window);
}());
}(require));

View file

@ -9,8 +9,7 @@
scope = exports;
}
else {
window.scope.hash = {};
scope = window.scope.hash;
scope = require.register("./hash", {});
}
scope.byteArrayToString = function byteArrayToString(byteArray){
return String.fromCharCode.apply(String, new Uint16Array(byteArray.buffer));

View file

@ -9,8 +9,7 @@
scope = exports;
}
else {
window.scope.intercept = {};
scope = window.scope.intercept;
scope = require.register("./intercept", {});
}
const {changedFunctions, changedGetters, setRandomSupply} = require("./modifiedAPI");

View file

@ -11,8 +11,7 @@
scope = exports;
}
else {
window.scope.lists = {};
scope = window.scope.lists;
scope = require.register("./lists", {});
}
var settings = require("./settings");

View file

@ -10,10 +10,12 @@
scope = exports;
}
else {
if (!window.scope.logging){
window.scope.logging = {};
if (require.exists("./logging")){
scope = require("./logging");
}
else {
scope = require.register("./logging", {});
}
scope = window.scope.logging;
}
let settings = false;

View file

@ -9,8 +9,7 @@
scope = exports;
}
else {
window.scope.modifiedAPI = {};
scope = window.scope.modifiedAPI;
scope = require.register("./modifiedAPI", {});
}
const colorStatistics = require("./colorStatistics");

View file

@ -9,8 +9,7 @@
scope = exports;
}
else {
window.scope.modifiedAPIFunctions = {};
scope = window.scope.modifiedAPIFunctions;
scope = require.register("./modifiedAPIFunctions", {});
}
scope.checkerWrapper = function checkerWrapper(checker, object, args, callback){

View file

@ -9,8 +9,7 @@
scope = exports;
}
else {
window.scope.modifiedAudioAPI = {};
scope = window.scope.modifiedAudioAPI;
scope = require.register("./modifiedAudioAPI", {});
}
const logging = require("./logging");

View file

@ -9,8 +9,7 @@
scope = exports;
}
else {
window.scope.modifiedDOMRectAPI = {};
scope = window.scope.modifiedDOMRectAPI;
scope = require.register("./modifiedDOMRectAPI", {});
}
const {checkerWrapper, setProperties: setProperties} = require("./modifiedAPIFunctions");

View file

@ -9,8 +9,7 @@
scope = exports;
}
else {
window.scope.modifiedHistoryAPI = {};
scope = window.scope.modifiedHistoryAPI;
scope = require.register("./modifiedHistoryAPI", {});
}
const {checkerWrapper} = require("./modifiedAPIFunctions");

View file

@ -9,8 +9,7 @@
scope = exports;
}
else {
window.scope.modifiedWindowAPI = {};
scope = window.scope.modifiedWindowAPI;
scope = require.register("./modifiedWindowAPI", {});
}
const {checkerWrapper} = require("./modifiedAPIFunctions");

View file

@ -9,8 +9,7 @@
scope = exports;
}
else {
scope = {};
window.scope.notification = scope;
scope = require.register("./notification", {});
}
const settings = require("./settings");

View file

@ -9,8 +9,7 @@
scope = exports;
}
else {
scope = {};
window.scope.persistentRndStorage = scope;
scope = require.register("./persistentRndStorage", {});
}

View file

@ -9,8 +9,7 @@
scope = exports;
}
else {
window.scope.randomSupplies = {};
scope = window.scope.randomSupplies;
scope = require.register("./randomSupplies", {});
}
const rngTemplate = {

View file

@ -39,13 +39,14 @@ const require = function(){
}
require.register = function(moduleName, module = {}){
const scopeName = getScopeName(moduleName);
if (!require.exists(moduleName)){
const scopeName = getScopeName(moduleName);
scope[scopeName] = module;
return module;
}
else {
require("./logging").error("Module", moduleName, "already registered.");
return scope[scopeName];
}
};

View file

@ -9,8 +9,7 @@
scope = exports;
}
else {
window.scope.search = {};
scope = window.scope.search;
scope = require.register("./search", {});
}
const texts = [];

View file

@ -9,8 +9,7 @@
scope = exports;
}
else {
scope = {};
window.scope.settingContainers = scope;
scope = require.register("./settingContainers", {});
}
const logging = require("./logging");

View file

@ -346,6 +346,6 @@
module.exports = settingDefinitions;
}
else {
window.scope.settingDefinitions = settingDefinitions;
require.register("./settingDefinitions", settingDefinitions);
}
}());

View file

@ -9,8 +9,7 @@
scope = exports;
}
else {
scope = {};
window.scope.settingStrings = scope;
scope = require.register("./settingStrings", {});
}
scope.getMessages = function(settingDefinition){

View file

@ -1,7 +1,7 @@
/* 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(){
(function(require){
"use strict";
var scope;
@ -9,8 +9,7 @@
scope = exports;
}
else {
scope = {};
window.scope.settings = scope;
scope = require.register("./settings", {});
}
const logging = require("./logging");
@ -428,8 +427,8 @@
initEvents.forEach(function(callback){callback();});
return true;
};
if (window.scope.settingsData){
scope.init(window.scope.settingsData);
if (require.exists("./settingsData")){
scope.init(require("./settingsData"));
scope.loaded = Promise.resolve(false);
}
else {
@ -468,4 +467,4 @@
Object.seal(scope);
require.emit("./settings");
}());
}(require));

View file

@ -10,8 +10,7 @@
scope = exports;
}
else {
window.scope.settingsMigration = {};
scope = window.scope.settingsMigration;
scope = require.register("./settingsMigration", {});
}
scope.validVersions = [undefined, 0.1, 0.2, 0.3, 0.4, 0.5];
scope.transitions = {

View file

@ -11,8 +11,7 @@
scope = exports;
}
else {
window.scope.webgl = {};
scope = window.scope.webgl;
scope = require.register("./webgl", {});
}
scope.copyCanvasToWebgl = function copyCanvasToWebgl(window, canvas, webGLVersion = "webgl"){