Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

deferred-proxy-chain

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

deferred-proxy-chain

Allows collecting chained calls that are evaluated asynchronously when the target object arrives

  • 0.0.2
  • latest
  • npm
  • Socket score

Version published
Weekly downloads
300
increased by120.59%
Maintainers
1
Weekly downloads
 
Created
Source

deferred-proxy-chain

Allows collecting chained calls that are evaluated asynchronously when the target object arrives

How to use

    const deferred = new DeferredChain();
    const doSomething = deferred.getProxy().field.nested.doSomething;
    const target = {
      field: {
        nested: {
          doSomething() {
            return 'something';
          },
        },
      },
    };
    deferred.setTarget(target);
    
    const result = doSomething();

    expect(result).toEqual('something');

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

Keywords

FAQs

Package last updated on 25 Aug 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc