Skip to content

A Bloc is a singe encapsulated executable code bloc that sits on an event bus. bloc-promise enables you to invoke this bloc as you would call a promise

Notifications You must be signed in to change notification settings

twilson63/bloc-promise

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

bloc-promise

Bloc Promise is the invoker function of a bloc which provides a promise api.

This enables you to use all of your blocs using a promise api.

Usage

const exec = require('bloc-promise')(bus)

exec('GEOCODE', { address: '1234 Main Street', city: 'Anytown', state: 'SC', zip: '29464'})
  .then(res => console.log(res))
  .catch(foo => console.log(foo))

bloc-promise takes three inputs:

  • adapter/bus - this adpater bus, must support .on, once, and .emit functions
  • bloc type - this is a string that is the bloc type that is used to invoke the bloc
  • payload - this is the data that is sent to the bloc as input.

returns

The bloc-promise will always return an object as a result.

About

A Bloc is a singe encapsulated executable code bloc that sits on an event bus. bloc-promise enables you to invoke this bloc as you would call a promise

Resources

Stars

Watchers

Forks

Packages

No packages published

Contributors 2

  •  
  •