xulrunner - XUL + javascript module : TypeError: xxx.yyyy is not a function -
i'm playing xul , modules ( https://developer.mozilla.org/en-us/docs/mozilla/javascript_code_modules/using )
i've defined small module: under hello01/chrome/content/js/hello.jsm
this.exported_symbols = ["hello", "foo"]; function foo() { return "foo"; } var hello = { name : "bar", size : 3, incr : function() { this.size++; return this.size; }, open : function() { return this.incr(); } }; this module loaded hello01/chrome/content/main.js
components.utils.import("chrome://hello/content/js/hello.jsm"); function jsdump(str) { components.classes['@mozilla.org/consoleservice;1'] .getservice(components.interfaces.nsiconsoleservice) .logstringmessage(str); } function showmore() { document.getelementbyid("more-text").hidden = false; jsdump("hello!"); jsdump(hello.incr()); jsdump(hello.open()); } from xul window:
(...) <button label="more >>" oncommand="showmore();"/> (...) when click on button, see in jsconsole :
hello ! 4 error: typeerror: hello.open not function source file: chrome://hello/content/main.js line: 14 why xul know hello.incr not hello.open ?
update: code available here: https://github.com/lindenb/xul-bootstrap
ok, got it: xul-runner caches files under ${home}/${vendor} silently ignored changes , used old file in cache. see xulrunner ignores updates on edited files
Comments
Post a Comment