667
edits
Changes
→Integrating with the build systetm
this.initialized = true;
this.firstxpcom = Components.classes["@senecac.on.ca/firstxpcom;1"]
this.firstxpcom.name = "First XPCOM";
},
// Use the Alerts Service to display the results to the user.
var alertsService = Components.classes["@mozilla.org/alerts-service;1"]
alertsService.showAlertNotification(null, this.firstxpcom.name, this.total,
false, "", null);
this.initialized = true;
this.firstxpcom = Components.classes["@senecac.on.ca/firstxpcom;1"]
this.firstxpcom.name = "First XPCOM";
// Use the Alerts Service to display the results to the user.
var alertsService = Components.classes["@mozilla.org/alerts-service;1"]
alertsService.showAlertNotification(null, this.firstxpcom.name, this.total,
false, "", null);
this.firstxpcom = Components.classes["@senecac.on.ca/firstxpcom;1"]
var alertsService = Components.classes["@mozilla.org/alerts-service;1"]
In the former case we use '''createInstance''', which gives us a new unique instance. In the latter, we use '''getService''', which returns a shared instance of an existing component (i.e., a Singleton). Unlike IFirstXpcom, which can be created many times by different callers, the nsIAlertsService is a shared component, because only one pop-up message at a time can be shown to the user.
The '''onOK''' function occurs when the user clicks the accept button (i.e., OK). When this happens the values from the textboxes are obtained and packaged up in the '''out''' parameter we sent in earlier. This is how we pass values back to the main window, and our extension code in '''firstxpcomchrome'''.
=Reflections=