Skip to content

Commit

Permalink
fix: proxy non-promised methods in browser-snippet (#591)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
justin-fiedler committed Sep 26, 2023
1 parent 5374314 commit 2e6c3b6
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions scripts/templates/browser-snippet.template.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 2e6c3b6

Please sign in to comment.