/**
* Singleton that provides the public API of this JSM.
*/
this.NewTabUtils = {
a_Property_is_here: false,
Some_Method_A: function Some_Method_A() {
}
Some_Method_B: function Some_Method_A() {
}
And_so_on: function And_so_on() {
}
links: Links,
allPages: AllPages,
linkChecker: LinkChecker,
pinnedLinks: PinnedLinks,
blockedLinks: BlockedLinks,
gridPrefs: GridPrefs,
placesProvider: PlacesProvider,
activityStreamLinks: ActivityStreamLinks,
activityStreamProvider: ActivityStreamProvider
};
What does the part "var{properties}=NewTabUtils;" mean? I understand if that's "NewTabUtils={properties};"
And another minor question is about the second script, in the Class-like JS methods, properties are asigned at bottom of the script, also bottom of the file. I guess that's because it is easy to read, but not sure the reason.
{properties} = object syntax
in JavaScript
Posted
Cu.import("resource://gre/modules/NewTabUtils.jsm"); var { links: gLinks, allPages: gAllPages, linkChecker: gLinkChecker, pinnedLinks: gPinnedLinks, blockedLinks: gBlockedLinks, gridPrefs: gGridPrefs } = NewTabUtils;
and the scipt of NewTabUtils.jsm is
/** * Singleton that provides the public API of this JSM. */ this.NewTabUtils = { a_Property_is_here: false, Some_Method_A: function Some_Method_A() { } Some_Method_B: function Some_Method_A() { } And_so_on: function And_so_on() { } links: Links, allPages: AllPages, linkChecker: LinkChecker, pinnedLinks: PinnedLinks, blockedLinks: BlockedLinks, gridPrefs: GridPrefs, placesProvider: PlacesProvider, activityStreamLinks: ActivityStreamLinks, activityStreamProvider: ActivityStreamProvider };
What does the part "var{properties}=NewTabUtils;" mean? I understand if that's "NewTabUtils={properties};"
And another minor question is about the second script, in the Class-like JS methods, properties are asigned at bottom of the script, also bottom of the file. I guess that's because it is easy to read, but not sure the reason.
Would somebody know these questions?
thanks.