hyper-path
Traverse a hyper api
Installation
Node
$ npm install hyper-path
Component
$ component install hypergroup/hyper-path
Usage
var client = ; /** * create a agent */ { // make a request to the root of the api here and call // fn(err, body);} agent { // make a request to the href and call // fn(err, body);} ;
Agents can offer subscriptions and call fn
anytime the data changes at the href
. The methods should return an unsubscribe
function so the request can clean itself up when calling off
.
{ // make a request here return { // implement me! }} agent { // make a request here return { // implement me! }} var req = ; // stop listening to api changesreq;
Clients can also use a scope for requests with the scope
method.
scopelocal: href: '/path/to/resource' ;
The function passed to on will be refreshed anytime the scope is updated.
var req = ; reqscopelocal: href: '/new/path/to/other/resource';
Tests
$ npm install$ npm test