Class: Provider

Provider

Created by fin.desktop.Service.register. Used to implement a service.

Constructor

new Provider()

Extends

Methods

afterAction(middleware)

Register middleware that fires after the action It is passed the return value of the action Middleware is of type: (action: string, payload, senderId) The return value of the middleware function will be used as the response unless it is undefined In that case the return value of the action is used. This can be used for side effects

Parameters:
Name Type Description
middleware Middleware
Inherited From:

beforeAction(middleware)

Register middleware that fires before the action Middleware is of type: (action: string, payload, senderId) The return value of the middleware function will be used as the payload for the action listener unless it is undefined In that case the original payload is used. This can be used for side effects

Parameters:
Name Type Description
middleware Middleware
Inherited From:

dispatch(to, action, payload) → {Promise.<any>}

dispatch an action to the specified client. Receive a promise for the result of executing that action on the client side.

Parameters:
Name Type Description
to Identity
action string
payload *
Returns:
Type
Promise.<any>

onConnection(listener)

Register a listener called on every connection It is passed the identity of the connecting client and a payload if it was provided to fin.desktop.Service.connect Throw an error to reject the connection.

Parameters:
Name Type Description
listener ConnectionListener

onError(middleware)

Register an error handler. This is called before responding on any error

Parameters:
Name Type Description
middleware function
Inherited From:

publish(action, payload)

Publish a action and payload to every connected client Synchronously returns an array of promises for each action (see dispatch)

Parameters:
Name Type Description
action string
payload *

register(actionName, Action)

register an action to be called

Parameters:
Name Type Description
actionName string
Action Action
Inherited From:

remove(action)

remove an action by name

Parameters:
Name Type Description
action string
Inherited From:

setDefaultAction(middleware)

Sets a default action. This is used any time a string is passed without a registered action. Default behavior is to throw an error

Parameters:
Name Type Description
middleware Middleware
Inherited From: