Last active
July 5, 2025 12:52
-
-
Save spion/00b2f2caabdfd0ea8c20dbfcff482ef2 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Reaction, untracked } from 'mobx' | |
import { enableExternalSource } from 'solid-js' | |
let id = 0 | |
enableExternalSource((fn, trigger) => { | |
const reaction = new Reaction(`externalSource@${++id}`, trigger) | |
return { | |
track: x => { | |
let next | |
reaction.track(() => (next = fn(x))) | |
return next | |
}, | |
dispose: () => { | |
reaction.dispose() | |
}, | |
} | |
}, untracked) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment