1
0
mirror of https://github.com/kkapsner/CanvasBlocker synced 2024-10-31 18:38:45 +01:00

Improved exportFunctionWithName

To reduce the need of double exports.
This commit is contained in:
kkapsner 2020-11-02 13:11:50 +01:00
parent c16068ca85
commit d5417cf807

View File

@ -95,7 +95,8 @@
};
scope.exportFunctionWithName = function exportFunctionWithName(func, context, name){
const exportedTry = exportFunction(func, context, {allowCrossOriginArguments: true});
const targetObject = scope.getWrapped(context).Object.create(null);
const exportedTry = exportFunction(func, targetObject, {allowCrossOriginArguments: true, defineAs: name});
if (exportedTry.name === name){
return exportedTry;
}