gracefull fallback for TrustedFunction

This commit is contained in:
Johannes Rieken
2021-01-08 11:30:42 +01:00
parent 44c9b4bb7f
commit ed6c343edb

View File

@@ -33,7 +33,10 @@ namespace TrustedFunction {
});
export function create(...args: string[]): Function {
return self.eval(ttpTrustedFunction?.createScript('', ...args) as unknown as string);
if (!ttpTrustedFunction) {
return new Function(...args);
}
return self.eval(ttpTrustedFunction.createScript('', ...args) as unknown as string);
}
}