proxy-call

0.0.2 • Public • Published

proxy

Proxy methods on host object until a promise has resolved.

 
var proxy = require('proxy-call');
 
var api = {
  method1: function() { /* ... */ },
  method2: function() { /* ... */ }
};
 
// proxy method1 and method2
proxy(api, ['method1', 'method2'], function load(){
  /* load stuff and return a promise */ 
});
 
// call your api now 
api
  .method1(args)
  .then(function() {});
  

API

proxy(host, methods, getPromise)

host

Type: Object

The host object you want to proxy

methods

Type: Array

List of methods of the host object you want to proxy

methods

Type: Function

A function that return a promise to resolve before executing proxied method

License

MIT

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 0.0.2
    0
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 0.0.2
    0

Package Sidebar

Install

npm i proxy-call

Weekly Downloads

0

Version

0.0.2

License

MIT

Last publish

Collaborators

  • pgherveou2