JSPM

deferred-definition

1.0.1
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 1
  • Score
    100M100P100Q14911F
  • License MIT

Use promises to await property definitions on an object.

Package Exports

  • deferred-definition

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (deferred-definition) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

deferred-definition

If you need to wait for an object property to be defined and other message passing just won't do it for you, this is your module. That said using deferred-definition is an extreme measure. There is almost definitely a more sensible async/await/event loop solution for your problem out there. Also, this module relies on Proxies, which will break most transpilation to ES5 since Babel does not support them.

Installation

# as a npm module (recommended)
npm install [...options] deferred-definition

installation via the git repo url is also possible; see https://docs.npmjs.com/cli/install, git subtree --help, and git submodule --help

Usage

const assert = require('assert');
const {deferrable} = require('../src/index.js');
const deferred = deferrable({});
assert(deferred.property instanceof Promise);
deferred.property.then((property)=>{assert(property);});
deferred.property = true;
refOne.then(assert);

Contributing

Please do.

If you decide to contribute, please to lint, test, and document your code.