action

action.regist(pathPattern, service)

Register a service instance to action

Kind: static method of action

Param Type Description
pathPattern string | RestFul | RegExp The path of the service
service Object The service object to be registered

Example

action.regist('/person', new Service());
 action.regist('/person/:id', new Service());
 action.regist(/^person\/\d+/, new Service());

action.unregist(pathPattern)

Un-register a service by path

Kind: static method of action

Param Type Description
pathPattern string | RestFul | RegExp The path of the service

action.dispatch(current, prev) ⇒ Promise

Switch from the previous service to the current one. Call prev.detach, prev.destroy, current.create, current.attach in serial. Typically called by the Router, you may not want to call dispatch manually.

If any of these callbacks returns a Thenable, it'll be await. If the promise is rejected, the latter callbacks will NOT be called.

Returns a promise that resolves if all callbacks executed without throw (or reject), rejects if any of the callbacks throwed or rejected.

Note: If current and prev is the same service, the prev.destroy will NOT be called.

Kind: static method of action

Param Type Description
current Object The current scope
prev Object The previous scope

action.isIndexPage() ⇒ boolean

Check if currently in initial page

Kind: static method of action
Returns: boolean - whether current page is the index page

action.exist(urlPattern) ⇒ boolean

Check if the specified service has been registered

Kind: static method of action
Returns: boolean - Returns true if it has been registered, else false.

Param Type Description
urlPattern string The path of the service

action.config(options) ⇒ Object

config the action, called by action.start

Kind: static method of action
Returns: Object - result config object

Param Type Description
options Object key/value pairs to config the action

action.redirect(url, query, options, data)

Redirect to another page, and change to next state

Kind: static method of action

Param Type Description
url string The URL to redirect
query string The query string to redirect
options Object The router options to redirect
options.title string Optional, 页面的title
options.force boolean Optional, 是否强制跳转
options.silent boolean Optional, 是否静默跳转(不改变URL)
data Object extended data being passed to current.options

action.back()

Back to last state

Kind: static method of action

action.reset(url, query, options, data)

Reset/replace current state

Kind: static method of action

Param Type Description
url string The URL to reset
query string The query string to reset
options Object The router options
options.title string Optional, 页面的title
options.force boolean Optional, 是否强制跳转
options.silent boolean Optional, 是否静默跳转(不改变URL)
data Object extended data being passed to current.options

action.start(options)

Action init, call this to start the action

Kind: static method of action

Param Type Description
options Object key/value pairs to config the action, calling action.config() internally

action.stop()

Stop Ralltiir redirects

Kind: static method of action

action.destroy()

Destroy the action, eliminate side effects: DOM event listeners, cache namespaces, external states

Kind: static method of action

action.update(url, query, options, data) ⇒ Object

Update page, reset or replace current state accordingly

Kind: static method of action
Returns: Object - the action object

Param Type Description
url string The URL to update
query string The query string to update
options Object The router options to update
data Object The extended data to update, typically contains container, page, and view

action.partialUpdate([url], [options=]) ⇒ Promise

Update partial content

Kind: static method of action
Returns: Promise - A promise resolves when update finished successfully, rejected otherwise

Param Type Default Description
[url] string null The url to update to, do not change url if null
[options=] string Update options
[options.from=] string The container element or the selector of the container element in the DOM of the retrieved HTML
[options.to=] string The container element or the selector of the container element in the current DOM
[options.fromUrl] string "url" The url of the HTML to be retrieved
[options.replace] boolean false Whether or not to replace the contents of container element

results matching ""

    No results matching ""