Skip to content

Commit

Permalink
fix externs.js and the exported symbols (closes #216)
Browse files Browse the repository at this point in the history
  • Loading branch information
thheller authored and tonsky committed Nov 29, 2018
1 parent 7fbb484 commit 68a438d
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 23 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

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

# 0.16.9

Expand Down
2 changes: 2 additions & 0 deletions src/datascript/db.cljc
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,8 @@
(assoc [d k v] (assoc-datom d k v))
]))

#?(:cljs (goog/exportSymbol "datascript.db.Datom" Datom))

(defn ^Datom datom
([e a v] (Datom. e a v tx0 true))
([e a v tx] (Datom. e a v tx true))
Expand Down
26 changes: 17 additions & 9 deletions src/datascript/externs.js
Original file line number Diff line number Diff line change
@@ -1,18 +1,26 @@
var datascript = {};
datascript.db = {};
datascript.db.Datom = {};
datascript.db.Datom.e = 0;
datascript.db.Datom.a = "";
datascript.db.Datom.v = "";
datascript.db.Datom.tx = 0;
datascript.db.Datom.added = true;

/**
* @constructor
*/
datascript.db.Datom = function() {};
datascript.db.Datom.prototype.e;
datascript.db.Datom.prototype.a;
datascript.db.Datom.prototype.v;
datascript.db.Datom.prototype.tx;
datascript.db.Datom.prototype.added;


datascript.impl = {};
datascript.impl.entity = {};
datascript.impl.entity.Entity = {};
datascript.impl.entity.Entity.db = {};
datascript.impl.entity.Entity.eid = {};

/**
* @constructor
*/
datascript.impl.entity.Entity = function() {};
datascript.impl.entity.Entity.prototype.db;
datascript.impl.entity.Entity.prototype.eid;
datascript.impl.entity.Entity.prototype.keys = function() {};
datascript.impl.entity.Entity.prototype.entries = function() {};
datascript.impl.entity.Entity.prototype.values = function() {};
Expand Down
15 changes: 1 addition & 14 deletions src/datascript/impl/entity.cljc
Original file line number Diff line number Diff line change
Expand Up @@ -198,17 +198,4 @@
(vreset! (.-touched e) true)))
e)

#?(:cljs (do
(goog/exportSymbol "datascript.impl.entity.Entity.prototype.get" (.-get (.-prototype Entity)))
(goog/exportSymbol "datascript.impl.entity.Entity.prototype.has" (.-has (.-prototype Entity)))
(goog/exportSymbol "datascript.impl.entity.Entity.prototype.forEach" (.-forEach (.-prototype Entity)))
(goog/exportSymbol "datascript.impl.entity.Entity.prototype.key_set" (.-key_set (.-prototype Entity)))
(goog/exportSymbol "datascript.impl.entity.Entity.prototype.value_set" (.-value_set (.-prototype Entity)))
(goog/exportSymbol "datascript.impl.entity.Entity.prototype.entry_set" (.-entry_set (.-prototype Entity)))
(goog/exportSymbol "datascript.impl.entity.Entity.prototype.keys" (.-keys (.-prototype Entity)))
(goog/exportSymbol "datascript.impl.entity.Entity.prototype.values" (.-values (.-prototype Entity)))
(goog/exportSymbol "datascript.impl.entity.Entity.prototype.entries" (.-entries (.-prototype Entity)))

(goog/exportSymbol "cljs.core.ES6Iterator.prototype.next" (.-next (.-prototype cljs.core/ES6Iterator)))
(goog/exportSymbol "cljs.core.ES6EntriesIterator.prototype.next" (.-next (.-prototype cljs.core/ES6EntriesIterator)))
))
#?(:cljs (goog/exportSymbol "datascript.impl.entity.Entity" Entity))

0 comments on commit 68a438d

Please sign in to comment.