mirror of
https://github.com/kkapsner/CanvasBlocker
synced 2025-07-04 20:46:39 +02:00
Minor performance improvements
This commit is contained in:
parent
a89bf0aba8
commit
103397e35d
2 changed files with 12 additions and 23 deletions
|
@ -13,25 +13,16 @@
|
|||
}
|
||||
|
||||
scope.getWrapped = function getWrapped(obj){
|
||||
if (!obj){
|
||||
return obj;
|
||||
}
|
||||
var wrapped;
|
||||
try {
|
||||
wrapped = obj.wrappedJSObject || obj;
|
||||
}
|
||||
catch (e){
|
||||
require("./logging").error("getWrapped failed for", obj, ":", e);
|
||||
wrapped = obj;
|
||||
}
|
||||
return wrapped;
|
||||
return obj && (obj.wrappedJSObject || obj);
|
||||
};
|
||||
|
||||
scope.checkerWrapper = function checkerWrapper(checker, object, args, callback){
|
||||
const check = checker.call(object);
|
||||
if (check.allow){
|
||||
if (check.allow === true){
|
||||
return check.original.apply(object, check.window.Array.from(args));
|
||||
return args.length?
|
||||
check.original.apply(object, check.window.Array.from(args)):
|
||||
check.original.call(object);
|
||||
}
|
||||
return callback.call(object, args, check);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue