Skip to content

Commit 68a438d

Browse files
thhellertonsky
authored andcommitted
fix externs.js and the exported symbols (closes #216)
1 parent 7fbb484 commit 68a438d

File tree

4 files changed

+21
-23
lines changed

4 files changed

+21
-23
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
- Implement `clojure.data/diff` on `datascript/DB` (#281)
44
- Drop Clojure 1.7 and 1.8 support
5+
- Fix externs.js syntax (PR #216, thx @thheller)
56

67
# 0.16.9
78

src/datascript/db.cljc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,8 @@
174174
(assoc [d k v] (assoc-datom d k v))
175175
]))
176176

177+
#?(:cljs (goog/exportSymbol "datascript.db.Datom" Datom))
178+
177179
(defn ^Datom datom
178180
([e a v] (Datom. e a v tx0 true))
179181
([e a v tx] (Datom. e a v tx true))

src/datascript/externs.js

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,26 @@
11
var datascript = {};
22
datascript.db = {};
3-
datascript.db.Datom = {};
4-
datascript.db.Datom.e = 0;
5-
datascript.db.Datom.a = "";
6-
datascript.db.Datom.v = "";
7-
datascript.db.Datom.tx = 0;
8-
datascript.db.Datom.added = true;
3+
4+
/**
5+
* @constructor
6+
*/
7+
datascript.db.Datom = function() {};
8+
datascript.db.Datom.prototype.e;
9+
datascript.db.Datom.prototype.a;
10+
datascript.db.Datom.prototype.v;
11+
datascript.db.Datom.prototype.tx;
12+
datascript.db.Datom.prototype.added;
13+
914

1015
datascript.impl = {};
1116
datascript.impl.entity = {};
12-
datascript.impl.entity.Entity = {};
13-
datascript.impl.entity.Entity.db = {};
14-
datascript.impl.entity.Entity.eid = {};
1517

18+
/**
19+
* @constructor
20+
*/
21+
datascript.impl.entity.Entity = function() {};
22+
datascript.impl.entity.Entity.prototype.db;
23+
datascript.impl.entity.Entity.prototype.eid;
1624
datascript.impl.entity.Entity.prototype.keys = function() {};
1725
datascript.impl.entity.Entity.prototype.entries = function() {};
1826
datascript.impl.entity.Entity.prototype.values = function() {};

src/datascript/impl/entity.cljc

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -198,17 +198,4 @@
198198
(vreset! (.-touched e) true)))
199199
e)
200200

201-
#?(:cljs (do
202-
(goog/exportSymbol "datascript.impl.entity.Entity.prototype.get" (.-get (.-prototype Entity)))
203-
(goog/exportSymbol "datascript.impl.entity.Entity.prototype.has" (.-has (.-prototype Entity)))
204-
(goog/exportSymbol "datascript.impl.entity.Entity.prototype.forEach" (.-forEach (.-prototype Entity)))
205-
(goog/exportSymbol "datascript.impl.entity.Entity.prototype.key_set" (.-key_set (.-prototype Entity)))
206-
(goog/exportSymbol "datascript.impl.entity.Entity.prototype.value_set" (.-value_set (.-prototype Entity)))
207-
(goog/exportSymbol "datascript.impl.entity.Entity.prototype.entry_set" (.-entry_set (.-prototype Entity)))
208-
(goog/exportSymbol "datascript.impl.entity.Entity.prototype.keys" (.-keys (.-prototype Entity)))
209-
(goog/exportSymbol "datascript.impl.entity.Entity.prototype.values" (.-values (.-prototype Entity)))
210-
(goog/exportSymbol "datascript.impl.entity.Entity.prototype.entries" (.-entries (.-prototype Entity)))
211-
212-
(goog/exportSymbol "cljs.core.ES6Iterator.prototype.next" (.-next (.-prototype cljs.core/ES6Iterator)))
213-
(goog/exportSymbol "cljs.core.ES6EntriesIterator.prototype.next" (.-next (.-prototype cljs.core/ES6EntriesIterator)))
214-
))
201+
#?(:cljs (goog/exportSymbol "datascript.impl.entity.Entity" Entity))

0 commit comments

Comments
 (0)