File tree 6 files changed +76
-3
lines changed
6 files changed +76
-3
lines changed Original file line number Diff line number Diff line change
1
+ {
2
+ "proto" : true
3
+ }
Original file line number Diff line number Diff line change 1
1
#Tomes Release Notes
2
2
3
+ ##1 .0.0-beta.5
4
+ * Tomes now have a destroy method
5
+ * Add .jshintrc and run on tests
6
+
3
7
##1 .0.0-beta.4
4
8
* Update ` README.md ` to fix first link
5
9
6
10
##1 .0.0-beta.3
7
- * Update ` README.md ` to point to this fork.
11
+ * Update ` README.md ` to point to this fork
8
12
9
13
##1 .0.0-beta.2
10
14
* Tomes now have an unTome method
Original file line number Diff line number Diff line change @@ -102,6 +102,9 @@ Get all change operations from the Tome
102
102
###merge( * diff* )
103
103
Applies a change operation or an array of change operations to a Tome.
104
104
105
+ ###destroy( )
106
+ Makes the tome and all of it's sub-tomes emit destroy. Does not delete anything.
107
+
105
108
###unTome( )
106
109
Returns a regular javascript version of your Tome.
107
110
Original file line number Diff line number Diff line change @@ -630,6 +630,10 @@ Tome.prototype.unTome = function () {
630
630
return Tome . unTome ( this ) ;
631
631
} ;
632
632
633
+ Tome . prototype . destroy = function ( ) {
634
+ return Tome . destroy ( this ) ;
635
+ } ;
636
+
633
637
Tome . prototype . set = function ( key , val ) {
634
638
635
639
// We use this to set a property on a Tome to the specified value. This can
Original file line number Diff line number Diff line change 1
1
{
2
2
"name" : " @bjornstar/tomes" ,
3
3
"description" : " Evented Storage Agnostic Data API" ,
4
- "version" : " 1.0.0-beta.4 " ,
4
+ "version" : " 1.0.0-beta.5 " ,
5
5
"author" :
" Bjorn Stromberg <[email protected] >" ,
6
6
"maintainers" : [
7
7
{
"name" :
" Bjorn Stromberg" ,
"email" :
" [email protected] " }
8
8
],
9
9
"scripts" : {
10
- "test" : " node test"
10
+ "test" : " jshint index.js && node test"
11
11
},
12
12
"main" : " index.js" ,
13
13
"devDependencies" : {
Original file line number Diff line number Diff line change
1
+ var Tome = require ( '../..' ) ;
2
+
3
+ exports . testSelfDestroy = function ( test ) {
4
+ test . expect ( 5 ) ;
5
+
6
+ var a = { b : { c : 1 } , d : { e : 1 } } ;
7
+ var b = Tome . conjure ( a ) ;
8
+
9
+ function fail ( ) {
10
+ test . ok ( ) ;
11
+ }
12
+
13
+ function ok ( ) {
14
+ test . ok ( true ) ;
15
+ }
16
+
17
+ b . on ( 'readable' , fail ) ;
18
+
19
+ b . on ( 'destroy' , ok ) ;
20
+ b . b . on ( 'destroy' , ok ) ;
21
+ b . b . c . on ( 'destroy' , ok ) ;
22
+ b . d . on ( 'destroy' , ok ) ;
23
+ b . d . e . on ( 'destroy' , ok ) ;
24
+
25
+ b . destroy ( ) ;
26
+ // Calling a 2nd time shouldn't have any effect.
27
+ b . destroy ( ) ;
28
+
29
+ test . done ( ) ;
30
+ } ;
31
+
32
+ exports . testTomeDestroy = function ( test ) {
33
+ test . expect ( 5 ) ;
34
+
35
+ var a = { b : { c : 1 } , d : { e : 1 } } ;
36
+ var b = Tome . conjure ( a ) ;
37
+
38
+ function fail ( ) {
39
+ test . ok ( ) ;
40
+ }
41
+
42
+ function ok ( ) {
43
+ test . ok ( true ) ;
44
+ }
45
+
46
+ b . on ( 'readable' , fail ) ;
47
+
48
+ b . on ( 'destroy' , ok ) ;
49
+ b . b . on ( 'destroy' , ok ) ;
50
+ b . b . c . on ( 'destroy' , ok ) ;
51
+ b . d . on ( 'destroy' , ok ) ;
52
+ b . d . e . on ( 'destroy' , ok ) ;
53
+
54
+ Tome . destroy ( b ) ;
55
+ // Calling a 2nd time shouldn't have any effect.
56
+ Tome . destroy ( b ) ;
57
+
58
+ test . done ( ) ;
59
+ } ;
You can’t perform that action at this time.
0 commit comments