Class: Shark

Shark()

Represents the Shark main class. It's has only static methods and should be considered as a Singleton.

Constructor

new Shark()

Version:
  • 0.7.1.56, 2018.04.13
Source:

Methods

(static) addModelProcessor(methodName, methodBody, optionsopt)

Adds a model processors function. The model processors are methods identified by a name that must contain the model full path (eg. "Shark.__store.currentUser") and the name of a property of that model (eg. "userName") joined by an underscore.
This method will be automatically called whenever an input on the page, with the right "sh" data tags, triggers it's "change" or "input" event.
The default behaviour is that the content of the field became the value of the property, but if a model processor function exists, it's invoked and then you can change the default behaviour.
Parameters:
Name Type Attributes Description
methodName string The name of the new method. It must contain the model full path, an underscore and the name of a property of that model (eg. "Shark.__store.currentUser_userName").
methodBody function The function that will be executed when the method will be called.
options object <optional>
An object containing the options. (not used)
Source:

(static) get(itemName, forcedType)

Retrieve values from the main store. It supports object deconstruction
Parameters:
Name Type Description
itemName string | array -
forcedType string Deprecated
Source:

(static) getInstance(modelNameOrClass, modelDataopt) → {object}

Return an instance of the requested model, filled with the passed data if present.
Parameters:
Name Type Attributes Description
modelNameOrClass string The name of the model to instantiate. It must exist: prior of this call you must have called the createModel method withe the same model name and a model definition.
modelData object <optional>
An object containing the data to use to fill the new instance. (it just call the instance.parse method)
Version:
  • 1.1.0.10 - 2017.07.28
Source:
Returns:
Type
object

(static) init(optionsopt, forceReinitopt)

Parameters:
Name Type Attributes Default Description
options object <optional>
An object containing the options for initializing.
Properties
Name Type Attributes Default Description
commonEndPointsBase object <optional>
"" DEPRECATED and REMOVED The "base" parte of the URL for the remote request. Use this value only if you have common destination for all your API call. Otehrwise you can set different URL for each call.
labels object <optional>
[] An array of objects containing a list of labels to be used in conjunction with localization features.
remoteCallTimeOutDuration integer <optional>
15000 The number of millisecods that Shark should wait befor abort remote call.
dataManager object <optional>
DataManager DEPRECATED and REMOVED The Class to be used to manage the remote request. Not yet fully implemented.
templates object <optional>
{} An object containing html templates as strings. (documentation has to be written about creating templates object)
templateRenderer object <optional>
MustacheRenderer The Class responsible for rendering Views on screen. Must be a SharRenderer sub-class. Not yet fully implemented.
forceReinit boolean <optional>
false If true process initialize step even if the initialization phase has alredy been completed.
Source:

(static) openPage(pageIdOrJaw)

Open the requested View showing it on the screen
Parameters:
Name Type Description
pageIdOrJaw string | Jaw The view to register.
Source:

(static) registerView(jaw)

Register a view that can be used withe the openPage method.
Parameters:
Name Type Description
jaw Jaw The view to register.
Source: