1
0
mirror of https://github.com/kkapsner/CanvasBlocker synced 2024-12-22 12:50:36 +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){ 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){ if (exportedTry.name === name){
return exportedTry; return exportedTry;
} }