We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 5ae6029 commit 5765d95Copy full SHA for 5765d95
src/coconut/react/Key.hx
@@ -2,9 +2,18 @@ package coconut.react;
2
3
abstract Key(Dynamic) from String from Bool from Float from Int #if genes from {} #end {
4
#if !genes
5
- @:keep @:from static function ofObj(o:{}):Key untyped {
6
- var id = haxe.ds.ObjectMap.getId(o) || haxe.ds.ObjectMap.assignId(o);
7
- return id;
8
- }
+ @:keep @:from static function ofObj(o:{}):Key {
+ var id =
+ #if (js_es >= 6)
+ (cast o)[cast ID] ??= counter++;
9
+ #else
10
+ @:privateAccess (haxe.ds.ObjectMap.getId(o) || haxe.ds.ObjectMap.assignId(o));
11
+ #end
12
+ return id;
13
+ }
14
15
+ static var counter = 0;
16
+ static final ID = new js.lib.Symbol();
17
18
#end
-}
19
+}
0 commit comments