Reactivity adapter for S.js
Adapter
- ✅ Automatic Cleanup
- ❌ Scope check
The API of S.js doesn't allow reactive scope checking. You must manually disable reactivity when making calls outside a reactive scope to avoid memory leaks. You can do this by passing { reactive: false }
to your options (e.g. <collection>.find({ ... }, { reactive: false })
).
Installation
bash
$ npm install signaldb-plugin-sjs
Usage
js
import { Collection } from 'signaldb'
import reactivityAdapter from 'signaldb-plugin-sjs'
import S from 's-js'
const posts = new Collection({
reactivity: reactivityAdapter,
})
S(() => {
console.log(posts.find({ author: 'John' }).count())
})