> Why can't you just do:
> <script src="common.js"></script> ?
Duh, you're right; I assumed that I had to use the extension id to
reference the file, but I should have tried the simple way first :-)
Follow up question: I observed that a variable declared in the
background page to be of a certain class seems to lose its type
information if referenced from an event handler, similarly perhaps to
the way objects are JSON-ified when passed between content scripts and
the background page.
For example, if this is my background page:
0 <script src="foobar.js"></script>
1 <script>
2 var foo = new Foobar(); // Foobar declared in foobar.js
3
4 chrome.extension.onConnect.addListener(function(msg) {
5 foo.doSomething();
6 });
7 </script>
If I inspect the background page, and in the console get the value of
foo, it will be of type Foobar. But if I set a breakpoint on the
addListener handler, foo at line 5 is an Object, not a Foobar any
more. Which means that I can't call foo.doSomething().
Is this the expected behavior? If I declare the Foobar class inside
the background.html script, it seems to work OK. But if it's defined
in an external javascript file, source via <script src>, I see the
behavior described above.
Thanks,
matias
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Chromium-extensions" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/chromium-extensions?hl=en
-~----------~----~----~----~------~----~------~--~---