Skip to content

Framework-agnostic action orchestrator with an awesome type support

License

Notifications You must be signed in to change notification settings

chris-czopp/orchiee

Repository files navigation

Orchiee

Framework-agnostic action orchestrator with an awesome type support

Deploy Orchiee NPM Version

Installation

npm install --save @gluecodes/orchiee

Usage

import * as Fn from '@gluecodes/orchiee';

const someAction = async (): SomeType => {}
const observedSomeAction = Fn.be(someAction)

Fn.observe(Fn.calling(observedSomeAction), (isBeingCalled) => {
  // isBeingCalled is Boolean type
})

Fn.observe(Fn.called(observedSomeAction), (itsReturnedValue) => {
  // itsReturnedValue is SomeType and it's taken from someAction
})

Fn.observe(Fn.failed(observedSomeAction), (error) => {
  // error is Error type
})

Fn.observe(Fn.called(observedSomeAction, Fn.called(action1), Fn.called(action2)), (itsReturnedValue) => {
  // when action1() or action2() is triggered, this callback is triggered
})

// on cleanup of your framework
Fn.cleanup() // clears all listeners

License

MIT

About

Framework-agnostic action orchestrator with an awesome type support

Resources

License

Code of conduct

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published