views:

6

answers:

0

I am using extension bar and there are two javascript files in my extension. extension.js in the global.html and ui.js included in the bar file which is named extension-bar.html.

1.extension.js

 ExtensionName.Extension = {
    startup: function(){
    ExtensionName.UI.startup();
    }
    }

2.ui.js

  ExtensionName.UI = {
    startup: function(){
    alert("UI start up.");
    }
    }

But when I run ExtensionName.UI.startup(); in extension.js, Error came: TypeError: Result of expression 'ExtensionName.UI' [undefined] is not an object.

In extension-bar.html, I know when I want to use functions which included in global.html, I have to use this:

safari.extension.globalPage.contentWindow;

How to use functions which included in extension-bar.html in global.html?