borg-collective

1.2.95 • Public • Published

Resistance is futile

Specifying listeners

Listeners can be added by calling "onChange" on the instantiated collective with a listener config object. The object should have a property "path" which is a string or array of string paths which point to the path in the document you wish to listen to. the second argument should be the change handler.

const myChangeHandler = function( stateByPath, change )
{
    console.log( Object.keys( stateByPath ) )
    // prints [ "user.name", "user.age" ]

    console.log( change.path, change.value)
    // prints "user.name henk"
}

collective.onChange({
    path: [ 'user.name', 'user.age' ],
    handler: myChangeHandler
})

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 1.2.95
    3
    • latest

Version History

Package Sidebar

Install

npm i borg-collective

Weekly Downloads

3

Version

1.2.95

License

ISC

Unpacked Size

546 kB

Total Files

26

Last publish

Collaborators

  • kevinkleine
  • jwverzijden
  • clerk-systems