one
Version:
One is a new React Framework that makes Vite serve both native and web.
16 lines (14 loc) • 304 B
text/typescript
// TODO get proper type
type Query = any
export function subscribeToZeroQuery(
query: Query,
onUpdate: (val: any) => void
): () => void {
const view = query.materialize()
view.hydrate()
const unsubscribe = view.addListener(onUpdate)
return () => {
unsubscribe()
view.destroy()
}
}