0.1.9 • Published 3 years ago

@gluecodes/orchiee v0.1.9

Weekly downloads
-
License
MIT
Repository
github
Last release
3 years ago

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

0.1.8

3 years ago

0.1.9

3 years ago

0.1.6

3 years ago

0.1.5

3 years ago

0.1.4

3 years ago

0.1.3

3 years ago

0.1.2

3 years ago

0.1.1

3 years ago

0.1.0

3 years ago