Skip to content

Latest commit

 

History

History
20 lines (14 loc) · 393 Bytes

deferred.md

File metadata and controls

20 lines (14 loc) · 393 Bytes

deferred(cb)

Insert a value that is computed later, at the moment when it is needed

  const output = {
    results: loadRecords(),
    meta: deferred(async () => {
      /* generate metadata */
    })
  };

Parameters

cb - <AsyncFunction> Callback that produces the eventual value

Notes

deferred simply return an object with the callback as its onJSON handler.