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

Remove code duplications and cleanup

This commit is contained in:
kkapsner 2019-12-10 15:07:22 +01:00
parent 8e414becf0
commit 32f9ea7447
9 changed files with 58 additions and 117 deletions

View file

@ -13,7 +13,7 @@
}
const {sha256String: hashing} = require("./hash");
const {checkerWrapper} = require("./modifiedAPIFunctions");
const {checkerWrapper, setFunctionProperties, getStatusByFlag} = require("./modifiedAPIFunctions");
let randomSupply = null;
@ -156,12 +156,6 @@
randomSupply = supply;
};
function getStatus(obj, status, prefs){
status = Object.create(status);
status.active = prefs("protectAudio", status.url);
return status;
}
const getChannelDataAlreadyFakedArrays = new WeakMap();
// changed functions and their fakes
scope.changedFunctions = {
@ -275,9 +269,10 @@
}
},
};
Object.keys(scope.changedFunctions).forEach(function(key){
scope.changedFunctions[key].type = "readout";
scope.changedFunctions[key].getStatus = getStatus;
scope.changedFunctions[key].api = "audio";
setFunctionProperties(scope.changedFunctions, {
type: "readout",
getStatus: getStatusByFlag("protectAudio"),
api: "audio"
});
}());