1
1
/**
2
- * TSDB version : VERSION_TAG
2
+ * TSDB version : 20150924_222714_master_1.0.0_17ca0ad
3
3
*/
4
4
var __extends = ( this && this . __extends ) || function ( d , b ) {
5
5
for ( var p in b ) if ( b . hasOwnProperty ( p ) ) d [ p ] = b [ p ] ;
6
6
function __ ( ) { this . constructor = d ; }
7
- __ . prototype = b . prototype ;
8
- d . prototype = new __ ( ) ;
7
+ d . prototype = b === null ? Object . create ( b ) : ( __ . prototype = b . prototype , new __ ( ) ) ;
9
8
} ;
10
9
var Firebase = require ( 'firebase' ) ;
11
10
var PromiseModule = require ( 'es6-promise' ) ;
12
11
var Promise = PromiseModule . Promise ;
13
- var Version = 'VERSION_TAG ' ;
12
+ var Version = '20150924_222714_master_1.0.0_17ca0ad ' ;
14
13
/**
15
14
* The main Db module.
16
15
*/
@@ -48,6 +47,39 @@ var Db;
48
47
return defaultDb ;
49
48
}
50
49
Db . getDefaultDb = getDefaultDb ;
50
+ var Api ;
51
+ ( function ( Api ) {
52
+ /**
53
+ * Various kind of events that can be triggered when using {@link EventDetails}.
54
+ */
55
+ ( function ( EventType ) {
56
+ /**
57
+ * Unknown event type.
58
+ */
59
+ EventType [ EventType [ "UNDEFINED" ] = 0 ] = "UNDEFINED" ;
60
+ /**
61
+ * The value has been updated, used on entities when there was a change and on collections when an elements
62
+ * is changed or has been reordered.
63
+ */
64
+ EventType [ EventType [ "UPDATE" ] = 1 ] = "UPDATE" ;
65
+ /**
66
+ * The value has been removed, used on root entities when they are deleted, embedded and references when
67
+ * they are nulled, references also when the referenced entity has been deleted, and on collections when
68
+ * an element has been removed from the collection.
69
+ */
70
+ EventType [ EventType [ "REMOVED" ] = 2 ] = "REMOVED" ;
71
+ /**
72
+ * The value has been added, used on collections when a new element has been added.
73
+ */
74
+ EventType [ EventType [ "ADDED" ] = 3 ] = "ADDED" ;
75
+ /**
76
+ * Special event used on collection to notify that the collection has finished loading, and following
77
+ * events will be updates to the previous state and not initial population of the collection.
78
+ */
79
+ EventType [ EventType [ "LIST_END" ] = 4 ] = "LIST_END" ;
80
+ } ) ( Api . EventType || ( Api . EventType = { } ) ) ;
81
+ var EventType = Api . EventType ;
82
+ } ) ( Api = Db . Api || ( Db . Api = { } ) ) ;
51
83
/**
52
84
* Internal module, most of the stuff inside this module are either internal use only or exposed by other methods,
53
85
* they should never be used directly.
@@ -214,36 +246,6 @@ var Db;
214
246
return BindingImpl ;
215
247
} ) ( ) ;
216
248
Internal . BindingImpl = BindingImpl ;
217
- /**
218
- * Various kind of events that can be triggered when using {@link EventDetails}.
219
- */
220
- ( function ( EventType ) {
221
- /**
222
- * Unknown event type.
223
- */
224
- EventType [ EventType [ "UNDEFINED" ] = 0 ] = "UNDEFINED" ;
225
- /**
226
- * The value has been updated, used on entities when there was a change and on collections when an elements
227
- * is changed or has been reordered.
228
- */
229
- EventType [ EventType [ "UPDATE" ] = 1 ] = "UPDATE" ;
230
- /**
231
- * The value has been removed, used on root entities when they are deleted, embedded and references when
232
- * they are nulled, references also when the referenced entity has been deleted, and on collections when
233
- * an element has been removed from the collection.
234
- */
235
- EventType [ EventType [ "REMOVED" ] = 2 ] = "REMOVED" ;
236
- /**
237
- * The value has been added, used on collections when a new element has been added.
238
- */
239
- EventType [ EventType [ "ADDED" ] = 3 ] = "ADDED" ;
240
- /**
241
- * Special event used on collection to notify that the collection has finished loading, and following
242
- * events will be updates to the previous state and not initial population of the collection.
243
- */
244
- EventType [ EventType [ "LIST_END" ] = 4 ] = "LIST_END" ;
245
- } ) ( Internal . EventType || ( Internal . EventType = { } ) ) ;
246
- var EventType = Internal . EventType ;
247
249
/**
248
250
* Class describing an event from the Db. It is used in every listener callback.
249
251
*/
@@ -252,7 +254,7 @@ var Db;
252
254
/**
253
255
* The type of the event, see {@link EventType}.
254
256
*/
255
- this . type = EventType . UNDEFINED ;
257
+ this . type = Api . EventType . UNDEFINED ;
256
258
/**
257
259
* The payload of the event.
258
260
*
@@ -880,9 +882,9 @@ var Db;
880
882
SingleDbHandlerEvent . prototype . handleDbEvent = function ( ds , prevName ) {
881
883
this . parseValue ( ds ) ;
882
884
var evd = new EventDetails ( ) ;
883
- evd . type = EventType . UPDATE ;
885
+ evd . type = Api . EventType . UPDATE ;
884
886
if ( this . entity == null ) {
885
- evd . type = EventType . REMOVED ;
887
+ evd . type = Api . EventType . REMOVED ;
886
888
}
887
889
evd . payload = this . entity ;
888
890
evd . originalEvent = 'value' ;
@@ -1495,7 +1497,7 @@ var Db;
1495
1497
return new Promise ( function ( resolve , error ) {
1496
1498
var allProms = [ ] ;
1497
1499
_this . updated ( ctx , function ( det ) {
1498
- if ( det . type == EventType . LIST_END ) {
1500
+ if ( det . type == Api . EventType . LIST_END ) {
1499
1501
det . offMe ( ) ;
1500
1502
if ( allProms . length ) {
1501
1503
Promise . all ( allProms ) . then ( function ( ) {
@@ -1506,7 +1508,7 @@ var Db;
1506
1508
resolve ( _this . realField ) ;
1507
1509
}
1508
1510
}
1509
- if ( det . type != EventType . ADDED )
1511
+ if ( det . type != Api . EventType . ADDED )
1510
1512
return ;
1511
1513
if ( _this . isReference && deref ) {
1512
1514
var evt = _this . findCreateChildFor ( det . originalKey ) ;
@@ -1561,7 +1563,7 @@ var Db;
1561
1563
this . loaded = true ;
1562
1564
}
1563
1565
handler . ispopulating = false ;
1564
- det . type = EventType . LIST_END ;
1566
+ det . type = Api . EventType . LIST_END ;
1565
1567
handler . handle ( det ) ;
1566
1568
return ;
1567
1569
}
@@ -1570,13 +1572,13 @@ var Db;
1570
1572
subev . parseValue ( ds ) ;
1571
1573
val = subev . entity ;
1572
1574
if ( event == 'child_removed' ) {
1573
- det . type = EventType . REMOVED ;
1575
+ det . type = Api . EventType . REMOVED ;
1574
1576
}
1575
1577
else if ( event == 'child_added' ) {
1576
- det . type = EventType . ADDED ;
1578
+ det . type = Api . EventType . ADDED ;
1577
1579
}
1578
1580
else {
1579
- det . type = EventType . UPDATE ;
1581
+ det . type = Api . EventType . UPDATE ;
1580
1582
}
1581
1583
det . payload = val ;
1582
1584
if ( handler . istracking ) {
@@ -3109,4 +3111,3 @@ var defaultDb = null;
3109
3111
*/
3110
3112
var entEvent = new Db . Utils . WeakWrap ( ) ;
3111
3113
module . exports = Db ;
3112
- //# sourceMappingURL=Db3.js.map
0 commit comments