Skip to content

Publish and subscribe to database queries, serve as backbone of live query change detection engine

License

Notifications You must be signed in to change notification settings

beenotung/live-query-filter

Repository files navigation

live-query-filter

Publish and subscribe to database queries, serve as backbone of live query change detection engine.

Designed for web-redux

npm Package Version

Usage Example

import { createLiveQueryFilter } from 'live-query-filter'
import sinon from 'sinon' // for testing

let filter = createLiveQueryFilter()

let select_user1_profile = sinon.spy()

filter.subscribe(
  [{ table: 'user', id: 1, fields: ['username', 'rank'] }],
  select_user1_profile,
)
console.log(select_user1_profile.callCount) // 0

filter.publish([{ table: 'user', id: 1, fields: ['username'] }])
console.log(select_user1_profile.callCount) // 1

More examples refer to filter.spec.ts

License

This project is licensed with BSD-2-Clause

This is free, libre, and open-source software. It comes down to four essential freedoms [ref]:

  • The freedom to run the program as you wish, for any purpose
  • The freedom to study how the program works, and change it so it does your computing as you wish
  • The freedom to redistribute copies so you can help others
  • The freedom to distribute copies of your modified versions to others

About

Publish and subscribe to database queries, serve as backbone of live query change detection engine

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published