javascript - How to call a fucntion in.js -
please nice still learning code in javascript.
i working on firefox add-on , know how call function external .js file.
i have main.js file following code:
var self = require("sdk/self"); var pagemod = require("sdk/page-mod"); //var notification = require("notification-box"); //var notification = require("notification-box").notificationbox({ //'value': 'important-message', //'label': 'secure connection established', //'priority': 'warning_high', //'image': self.data.url("secure.png"), //}); pagemod.pagemod({ include: "https://*", var notification = require("notification-box").notificationbox({ 'value': 'important-message', 'label': 'secure connection established', 'priority': 'warning_high', 'image': self.data.url("secure.png"), });
the notificationbox function calls external file called notification-box.js purpose show notification bar @ top of page.
the purpose of above code show notification if the user visits https page.
when run above code error "missing : after property list"
sorry if makes no sense.
you cant stick var in middle of object:
pagemod.pagemod({ include: "https://*", notification: require("notification-box").notificationbox({ 'value': 'important-message', 'label': 'secure connection established', 'priority': 'warning_high', 'image': self.data.url("secure.png"), }), 'some_other_key': 'some other value' });
Comments
Post a Comment