GroupStore Object

This reference documents the properties and methods available on the GroupStore object.

Properties

GroupStore.loaded DataObject

A DataObject used to store details about the load command.

GroupStore.initialized DataObject

A DataObject used to store the initialized Group object.

Methods

get

Returns a Group object by key from the initialized property.

groups.get(key);

Arguments

NAMEREQUIREDTYPEDESCRIPTION
keyTrueStringThe key of the Group to return.

Returns

GroupObjectThe initialized Group object.

Examples

// Returns a Group with the key "login-contracts".
var group = groups.get('login-contracts');

add

Initializes a new Group object and stores the object in the initialized property.

groups.add(site, key, type, options, callback);

Arguments

NAMEREQUIREDTYPEDESCRIPTION
siteTrueSiteThe Site object that the Group belongs to.
keyTrueStringThe unique key of the Group.
typeTrueStringThe type of Group object to initialize, 'group' or 'badge', or a constructor function.
optionsTrueObjectThe configuration options and parameters to set on the Group object.
callbackFalseFunctionA callback function to execute once the Group has been initialized. The function receives two arguments: error and group.

Returns

No Return Value

Examples

// Initializes a ClickwrapGroup with the key "login-contracts".
groups.add(site, 'login-contracts', 'group', config, function(err, group) {
  if (err) console.error(err);
  else console.log('Group ' + group.get('key') + ' initialized.');
});

getLoading

Returns the value stored in the loaded property for the given key.

groups.getLoading(key);

Arguments

NAMEREQUIREDTYPEDESCRIPTION
keyTrueStringThe key of the Group to return.

Returns

String, Boolean, ObjectThe value stored in the loaded property.

Examples

// Returns the details about the load command for "login-contracts".
var val = groups.getLoading('login-contracts');  // 'true'

setLoading

Sets the value for a given key on the loaded property.

groups.setLoading(key, value);

Arguments

NAMEREQUIREDTYPEDESCRIPTION
keyTrueStringThe key of the Group to return.
valueTrueString, Boolean, ObjectDetails about the load command.

Returns

No Return Value

Examples

// Sets the details about the load command for "login-contracts".
groups.setLoading('login-contracts', 'contracts-container');