-
Notifications
You must be signed in to change notification settings - Fork 74
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Random Error: Uncaught ReferenceError: $LAB is not defined #11
Comments
I think the way loading happens in bootstrap.js is the culprit. It relies on an asynchronous loading technique to inject both lab.js and init.js, and so it's possible for init.js to be loaded before lab.js is executed: gmailr/chrome/lib/bootstrap.js Line 40 in 92330b0
One thing worth trying is replacing those // Load the initialization scripts
chrome.extension.sendMessage({ "action": "load_scripts", "payload": [
"lab.js",
"init.js"
]}); Then in a background.js file, add something like: chrome.extension.onMessage.addListener(
function (request, sender, sendResponse) {
if (request.action === 'load_scripts') {
var scripts = request.payload;
for (var i = 0, ilen = scripts.length; i < ilen; i++) {
chrome.tabs.executeScript(null, { "file": scripts[i] });
}
break;
}
}); I'd submit this as a pull request, but I wanted to check two things first:
|
The way I got round this is at the very bottom of lab.js I added: $LAB
.script(document.getElementById("init_path_gcgmailr_data").getAttribute('data-val'))
.wait(); In bootstrap.js I: addData("init_path", chrome.extension.getURL("lib/init.js"));
// and commented out
//loadScript(chrome.extension.getURL("lib/init.js")); this seemed to work for me |
I think to great extent I gave up on LAB and embedded my javascripts with On Fri, Nov 22, 2013 at 7:54 AM, Cyapow [email protected] wrote:
|
I'm seeing the following error in my console at random times:
Uncaught ReferenceError: $LAB is not defined
It pops from time to time, but most of the time the page is loading properly. Any idea what might be causing this?
The text was updated successfully, but these errors were encountered: