Title

Global

Methods

# Limiter()

A custom concurrent connection limiter for xmtoolbox

View Source limiter.js, line 4

# async request(options) → {Promise}

A request function to make http requests. Returns a promise that resolved to a string bod response or json if the response header content-type is json. The response may be modified using the transform option. Example Usage (async () => { const json = await request({ uri: 'http://192.168.2.123/api/something', method: 'POST', json: { name: 'POST TEST' } }); console.log(json); })();
Parameters:
Name Type Description
options Object object to make request. Supported keys: uri, method, headers, auth, json, transform. uri: The URI for the request. method: default is 'GET' but other standard https methods are supported (all caps) auth: {user: "", pass: ""} headers: {name: value} headers may be set with this. json: any data for requests for methods like post. transform: a function in the form of (data, body)=> {} to transform the retruned response. Otherwise the data is returned.

View Source request.js, line 34

Promise

# schedule(fn, …args)

Schedule a promise based task to be completed according the limiter configuration.
Parameters:
Name Type Attributes Description
fn *
args any <repeatable>

View Source limiter.js, line 30