From 2e6c3b6cb628d333749691f8c478a8e8a124325b Mon Sep 17 00:00:00 2001 From: Justin Fiedler Date: Tue, 26 Sep 2023 13:06:08 -0700 Subject: [PATCH] fix: proxy non-promised methods in browser-snippet (#591) * fix: proxy non-promised methods in browser-snippet * fix: removed extra semicolon in browser-snippet template * fix: revert manual generated file changes * chore: undo manual changes to generated snippet --- scripts/templates/browser-snippet.template.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/scripts/templates/browser-snippet.template.js b/scripts/templates/browser-snippet.template.js index cb6211e32..237a81d98 100644 --- a/scripts/templates/browser-snippet.template.js +++ b/scripts/templates/browser-snippet.template.js @@ -96,12 +96,19 @@ const snippet = (name, integrity, version, globalVar) => ` }); }; } + function proxyInstance(instance, fn, args) { + instance._q.push({ + name: fn, + args: Array.prototype.slice.call(args, 0), + }); + } function proxyMain(instance, fn, isPromise) { var args = arguments; instance[fn] = function () { if (isPromise) return { promise: new Promise(getPromiseResult(instance, fn, Array.prototype.slice.call(arguments))), }; + proxyInstance(instance, fn, Array.prototype.slice.call(arguments)); }; } function setUpProxy(instance) {