Matter In Motion. Browser client
Browser client for matter in motion framework
Installation
npm i mm-client-browser
Usage
;; const mm = host: 'localhost:3000' tls: false console; mm;mm;
Methods
constructor(settings)
Creates the matter-in-motion client. Settings are:
- host — string, the host name for the api server.
- tls — boolean, default true. Should client use secure connection.
- serializer — mime string, default 'application/json'. Data type mime that is expected from the server.
- api — string, path, default '/api'. Api path.
- log — function. Function that will be used to log.
addTransport(transport)
Adds a transport.
setTransport(name)
Sets default transport.
setAuth(controller)
Sets the authentication controller.
isAuthenticated()
Returns null
if no authentication controller defined. Othewise calls the this.auth.isAuthenticated
method and returns the result.
init(callback)
Inits all the transports. Initis the authentication controller if present. Calls callback.
call(call, body, options, cb)
Calls the api. Similar calls will be throttled.
will(call, fn)
Adds will call hook.
did(call, fn)
Adds did call hook.
License: MIT
© velocityzen