deferred-proxy-chain
Allows collecting chained calls that are evaluated asynchronously when the target object arrives
How to use
const deferred = ; const doSomething = deferredfieldnesteddoSomething; const target = field: nested: { return 'something'; } ; deferred; const result = ; ;
Requirements
- Support for Proxy object (available in node.js >= 6.5 and all modern browsers).
Features
- allows performing property chain or even method calls on nonexistent objects
- on chain can be executed against different target objects (calling setTarget multiple times)
- methods called in the chain are executed with the correct this object
Limitations
- doesn't support calls that resolves to a primitive value in the target object,
- doesn't cache values returned by the functions and getters in the chain – each call executed since the target object has been set, causes execution of the methods used earlier in the chain