Class: Client

Client

Created by fin.desktop.Service.connect. Used to implement the client side of a service

Constructor

new Client()

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(action, payload) → {Promise.<any>}

dispatch the given to the service provider, receive a promise for the result of that action.

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

onError(middleware)

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

Parameters:
Name Type Description
middleware function
Inherited From:

(async) onServiceDisconnect(listener) → {Promise.<void>}

Register a listener to fire in the case the service disconnects

Parameters:
Name Type Description
listener EventListener
Returns:
Type
Promise.<void>

register(action, listener) → {boolean}

Register an action to be called by the provider

Parameters:
Name Type Description
action string
listener Action
Overrides:
Returns:
Type
boolean

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: