Chrome.tabs.create Function Wrapper, Why Doesn This Work?
Solution 1:
Just guessing here, as I have no actual experience making Chrome extensions, but maybe the while() loop is hogging the thread and never really allowing the callback you specified in the call to create() to ever run. That's what would happen if you did this in a regular website.
Try adding a setTimeout() call to the waiting loop, so that, while it waits, it doesn't use any CPU, instead of using 100% of it... I'm not sure how you can do this in the context of your extension, the code you showed doesn't quite have enough context.
If I were doing this, however, instead of looping and waiting, i'd just add whatever you want to do once the tab is created in the callback function (right where you are setting returnTab). That's the normal way of doing stuff in JS...
Post a Comment for "Chrome.tabs.create Function Wrapper, Why Doesn This Work?"