Jump to content
Sign in to follow this  
Mnus

{properties} = object syntax

Recommended Posts

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.

Share this post


Link to post
Share on other sites

That syntax doesn't look valid.  What is that for, does that get run through an interpreter or something to produce regular Javascript?  What is .jsm?

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

×
×
  • Create New...