Methods
(static) defaults(object, defaults) → {object}
Populates an object with defaults if the key is not yet defined. Similar to _.defaults except this takes only a single defaults object.
Parameters:
Name | Type | Description |
---|---|---|
object |
object | the object to populate defaults on |
defaults |
object | the defaults to use |
Returns:
- Type
- object
(static) getAppSelf(callback) → {undefined}
Get the App object returned from mozApps.getSelf()
Parameters:
Name | Type | Description |
---|---|---|
callback |
module:utils~getAppSelfCallback | the callback function. |
Returns:
- Type
- undefined
(static) getCenteredCoordinates(w, h) → {list}
Gets the center coordinates for a passed width and height. Uses centering calcs that work on multiple monitors (bug 1122683).
Parameters:
Name | Type | Description |
---|---|---|
w |
number | width |
h |
number | height |
Returns:
- Type
- list
(static) getSelfOrigin() → {string}
Gets the app origin
Returns:
- Type
- string
(static) getUrlOrigin(url) → {string}
Gets the the origin of the URL provided.
Parameters:
Name | Type | Description |
---|---|---|
url |
string | the URL to introspect the origin from |
Returns:
- Type
- string
(static) logDeprecation(msg, versionDeprecated) → {undefined}
Log a deprecation message with some extra info.
Parameters:
Name | Type | Description |
---|---|---|
msg |
string | log message |
versionDeprecated |
string | the version when deprecated |
Returns:
- Type
- undefined
(static) openWindow(optionsopt) → {object}
Open a window
Parameters:
Name | Type | Attributes | Description | ||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options |
object |
<optional> |
the settings object Properties
|
Returns:
windowRef - a window reference.
- Type
- object
(static) reCenterWindow(winRef, wopt, hopt) → {undefined}
Re-center an existing window.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
winRef |
object | A reference to an existing window |
|
w |
number |
<optional> |
width |
h |
number |
<optional> |
height |
Returns:
- Type
- undefined
(static) serialize(obj) → {string}
Take an object of key value pairs and serialize it into a url-encoded query string.
Parameters:
Name | Type | Description |
---|---|---|
obj |
object | object to serialize |
Returns:
- Type
- string
Example
// returns foo=bar&baz=zup
utils.serialize({"foo": "bar", "baz": "zup"});
Type Definitions
getAppSelfCallback(error, appSelf)
The callback called by module:utils.getAppSelf
Parameters:
Name | Type | Description |
---|---|---|
error |
object | an error object. Will be null if no error. |
appSelf |
object | the appSelf object |