- Source:
Methods
(static) extender(config, socioscapes)
The socioscapes structure is inspired by the jQuery team's module management system. To extend socioscapes, you
simply need to call socioscapes.extender and provide an array of entries that are composed of an object with
'.path' (a string), and '.extension' (a value) members.
Parameters:
| Name | Type | Description | ||||||
|---|---|---|---|---|---|---|---|---|
config |
Array.<Object> | A valid socioscapes extension configuration.
Properties
|
||||||
socioscapes |
function | The socioscapes api global object. | ||||||
config[].alias |
string | A shorter alias that doesn't follow the above naming standards. | ||||||
config[].silent |
Boolean | If true, supresses console.log messages. | ||||||
config[].extension |
Object | Your extension. |
- Source:
(static) fetchFromScape(key, metaProperty, array) → {Object}
This internal method is used to extract a specific state, view, or layer from within a ScapeObject 'array' based on a
'key' and 'metaProperty' pairing.
Parameters:
| Name | Type | Description |
|---|---|---|
key |
number | string | An integer value that corresponds to an entry in the 'array' argument or a string that corresponds to a metaProperty value. |
metaProperty |
Object | The property in the '.meta' member that we are trying to match to (usually 'name'). |
array |
Object | The ScapeObject array that contains the state, view, or layer we are looking for. |
- Source:
Returns:
this
- Type
- Object
(static) fetchGlobal(name) → {Object}
This internal method is used to retrieve a variable from the global object.
Parameters:
| Name | Type | Description |
|---|---|---|
name |
string | A string that corresponds to a variable in the global object. |
- Source:
Returns:
myGlobal - Returns the corresponding ScapeObject or undefined.
- Type
- Object
(static) fetchGoogleAuth(config) → {Object}
This function requests authorization to use a Google API, and if received, loads that API client. For more information
on Google APIs, see http://developers.google.com/api-client-library/javascript/reference/referencedocs.
Parameters:
| Name | Type | Description | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
config |
Object | An object with configuration options for Google APIs.
Properties
|
- Source:
Returns:
this
- Type
- Object
(static) fetchGoogleBq(scapeObject, configopt) → {Object}
This internal method fetches data from Google BigQuery. If necessary, it also requests a gapi authorization token and
loads the gapi BigQuery client.
If successful, callsback with fetch results.
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
scapeObject |
Object | The ScapeObject within which the query results will be stored. | |
config |
Object |
<optional> |
A configuration object for the gapi.auth and gapi.config api. If missing, defaults will be used (see the 'gapiConfig' variable). |
- Source:
Returns:
scapeObject - The ScapeObject within which the query results will be stored.
- Type
- Object
(static) fetchGoogleGeocode(address) → {Object}
This internal method executes a Google Geocoder query for 'address' and returns the results in an object. Make sure
you obtain Google auth and load the GAPI client first.
Parameters:
| Name | Type | Description |
|---|---|---|
address |
String | The address around which the map around (eg. 'Toronto, Canada'). |
- Source:
Returns:
geocode - An object with latitude and longitude coordinates.
- Type
- Object
(static) fetchScape(scapeObject) → {Object}
This internal method is used to access a ScapeObjec. Currently limited to simply checking the global object but
future versions may allow loading from urls or local storage.
Parameters:
| Name | Type | Description |
|---|---|---|
scapeObject |
Object | A ScapeObject or a string that corresponds to a ScapeObject in the global object. |
- Source:
Returns:
myObject - Returns the corresponding ScapeObject or undefined.
- Type
- Object
(static) fetchScapeSchema(type) → {Object}
This internal method returns the .schema entry that corresponds to 'type'.
Parameters:
| Name | Type | Description |
|---|---|---|
type |
string | The type of schema definition to fetch. |
- Source:
Returns:
myObject - Returns the corresponding schema entry or undefined.
- Type
- Object
(static) fetchWfs(scapeObject, url) → {Object}
This internal method asynchronously fetches geometry from a Web Feature Service server. It expects geoJson and
returns the queried url, the id parameter, and the fetched features.
If successful, callsback with fetch results.
Parameters:
| Name | Type | Description |
|---|---|---|
scapeObject |
Object | The ScapeObject within which the query results will be stored. |
url |
string | A valid wfs url that returns geoJson FeatureCollection. |
- Source:
Returns:
scapeObject - The ScapeObject within which the query results will be stored.
- Type
- Object
(static) isValidName(name) → {Boolean}
This internal method tests if a name used for a socioscapes scape, state, layer, or extensions adheres to naming
restrictions.
Parameters:
| Name | Type | Description |
|---|---|---|
name |
string | This should be a valid http, https, ftp, or ftps URL and follow the "protocol://my.valid.url/my.file" pattern. |
- Source:
Returns:
- Type
- Boolean
(static) isValidObject(object) → {Boolean}
This internal method tests if an object adheres to the scape.sociJson standard.
Parameters:
| Name | Type | Description |
|---|---|---|
object |
Object | An object whose .meta.type === 'scape.sociJson'. |
- Source:
Returns:
- Type
- Boolean
(static) isValidUrl(url) → {Boolean}
This method tests the "URLiness" of a given string. It expects a string that fits the pattern
"protocol://my.valid.url/my.file" and supports the http, https, ftp, and ftps protocols.
Parameters:
| Name | Type | Description |
|---|---|---|
url |
string | This should be a valid http, https, ftp, or ftps URL and follow the "protocol://my.valid.url/my.file" pattern. |
- Source:
Returns:
- Type
- Boolean
(static) menuClass(context, nameopt) → {Object}
This method returns a ScapeObject object for schema entries where menu === 'menuClass'.
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
context |
Object | A context object sent by the a ScapeMenu call (this allows us to use the correct ScapeObject for our context). | |
name |
string |
<optional> |
Not implemented. |
- Source:
Returns:
- A socioscapes ScapeObject object.
- Type
- Object
(static) menuConfig(context, command, configopt) → {Object}
This method returns a ScapeObject object for schema entries where menu === 'menuConfig'.
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
context |
Object | A context object sent by the a ScapeMenu call (this allows us to use the correct ScapeObject for our context). | |
command |
string | Should correspond to a socioscapes.fn or soioscapes.fn.alias member name. | |
config |
Object |
<optional> |
A configuration object for the corresponding command function. |
- Source:
Returns:
context.that - A socioscapes ScapeObject object.
- Type
- Object
(static) menuRequire(context, command, configopt) → {Object}
This method returns a ScapeObject object for schema entries where menu === 'menuRequire'.
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
context |
Object | A context object sent by the a ScapeMenu call (this allows us to use the correct ScapeObject for our context). | |
command |
string | Should correspond to a socioscapes.fn or soioscapes.fn.alias member name. | |
config |
Object |
<optional> |
A configuration object for the corresponding command function. |
- Source:
Returns:
context.that - A socioscapes ScapeObject object.
- Type
- Object
(static) menuStore(context, command, configopt) → {Object}
This method returns a ScapeObject object for schema entries where menu === 'menuRequire'.
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
context |
Object | A context object sent by the a ScapeMenu call (this allows us to use the correct ScapeObject for our context). | |
command |
string | Should correspond to a socioscapes.fn or soioscapes.fn.alias member name. | |
config |
Object |
<optional> |
A configuration object for the corresponding command function. |
- Source:
Returns:
context.that - A socioscapes ScapeObject object.
- Type
- Object
(static) newCallback(argumentsArray) → {function}
This internal method checks to see if the last argument in an array contains a function. If it does, return that
function, else return an empty function.
Parameters:
| Name | Type | Description |
|---|---|---|
argumentsArray |
Array.<Object> | The arguments array of a function. |
- Source:
Returns:
myCallback - Any function.
- Type
- function
(static) newDispatcher() → {Object}
The socioscapes Dispatcher class helps to facilitate asynchronous method chaining and queues. Socioscapes
associates every 'scape' object with a unique dispatcher instance and id. The dispatcher allows for API calls to be
queued and synchronously resolved on a per-scape basis by attaching a unique dispatcher instance to every scape. The
api itself remains asynchronous. Calls to the dispatcher are expeted to provide an arguments array, myArguments, and
a function, myFunction. The first argument in myArguments should always be the object that myFunction modifes and/or
returns. myFunction is evaluated for the number of expected arguments (myFunction.length) and the dispatcher appends
null values for expected arguments that are missing. This is done so that a callback function can be appended to the
array and all functions that are executed through the dispatcher can safely assume that the element at index
myArguments.length is the dispatcher callback. Finally, a queue item consisting of the myFunction and myArguments
members is pushed into the dispatcher's queue array. The dispatcher works through each item in its queue by executing
myFunction(myArguments) and waiting for the callback function to fire an event that signals that the function has
returned a value and the dispatcher can safely move on to the next item its queue.
- Source:
Returns:
- Type
- Object
(static) newEvent(name, message)
This internal method is a CustomEvent wrapper that fires an arbitrary event. Socioscapes methods use it to signal
updates. For more information on CustomEvent, see https://developer.mozilla.org/en/docs/Web/API/CustomEvent.
Parameters:
| Name | Type | Description |
|---|---|---|
name |
String | The name of the new event (this is what your event handler will listen for). |
message |
Object | The content of the event.detail. |
- Source:
(static) newGlobal(name, object, overwriteopt) → {Object}
This internal method creates a new global object. *gasp*
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
name |
string | A valid name JavaScript object name. | |
object |
Object | The global object, either window or global. | |
overwrite |
Boolean |
<optional> |
If true, overwrite existing objects. |
- Source:
Returns:
myGlobal - The newly-created global object.
- Type
- Object
(static) newScapeMenu(scapeObject, socioscapesPrototype) → {Object}
This method creates ScapeMenu objects, which are the api interfaces that developers interact with.
Parameters:
| Name | Type | Description |
|---|---|---|
scapeObject |
Object | A valid ScapeObject. |
socioscapesPrototype |
Object | The socioscapes api prototype. |
- Source:
Returns:
- A socioscapes ScapeMenu object.
- Type
- Object
(static) newScapeObject(name, parent, type) → {Object}
This method creates socioscape ScapeObject objects.
Parameters:
| Name | Type | Description |
|---|---|---|
name |
string | A valid JavaScript name. |
parent |
Object | A valid ScapeObject or null. |
type |
string | A valid scape.sociJson scape class. |
- Source:
Returns:
- A socioscapes ScapeObject object.
- Type
- Object
(static) schema() → {Object}
This method creates socioscape schema objects.
- Source:
Returns:
- A socioscapes schema object.
- Type
- Object