tonsky / datascript

Immutable database and Datalog query engine for Clojure, ClojureScript and JS
Eclipse Public License 1.0
5.46k stars 304 forks source link

do `transact!` and `listen` work in the js api? #413

Closed uriva closed 2 years ago

uriva commented 2 years ago

Hi, great project. Does listen work in the js api?

This is what I tried:

connection = datascript.conn_from_datoms([{":db/id": -1, ":person/name": "alice"}, {":db/id": -2, "person/name": "bob"}]);
datascript.listen(connection, x => console.log(x));
datascript.transact(connection, [ {":db/id":  -1, ":person/name": "carol"}])

and expected the callback to be called immediately but it didn't.

I'm assuming transact is the parallel of transact! because I didn't find one with an exclamation mark in the js api.

uriva commented 2 years ago

I think my transact call is incorrect, followed the js tests and saw it's working.