File tree 3 files changed +30
-17
lines changed
packages/svelte/src/reactivity 3 files changed +30
-17
lines changed Original file line number Diff line number Diff line change
1
+ import { DEV } from 'esm-env' ;
1
2
import { INSPECT_SYMBOL } from '../internal/client/constants.js' ;
2
3
import { source , set } from '../internal/client/reactivity/sources.js' ;
3
4
import { get } from '../internal/client/runtime.js' ;
@@ -89,6 +90,12 @@ export class ReactiveDate extends Date {
89
90
return v ;
90
91
} ;
91
92
}
93
+
94
+ if ( DEV ) {
95
+ proto [ INSPECT_SYMBOL ] = function ( ) {
96
+ get ( this . #raw_time) ;
97
+ } ;
98
+ }
92
99
}
93
100
}
94
101
@@ -100,8 +107,4 @@ export class ReactiveDate extends Date {
100
107
super ( ...values ) ;
101
108
this . #init( ) ;
102
109
}
103
-
104
- [ INSPECT_SYMBOL ] ( ) {
105
- get ( this . #raw_time) ;
106
- }
107
110
}
Original file line number Diff line number Diff line change @@ -5,6 +5,8 @@ import { UNINITIALIZED } from '../constants.js';
5
5
import { map } from './utils.js' ;
6
6
import { INSPECT_SYMBOL } from '../internal/client/constants.js' ;
7
7
8
+ var inited = false ;
9
+
8
10
/**
9
11
* @template K
10
12
* @template V
@@ -21,6 +23,21 @@ export class ReactiveMap extends Map {
21
23
constructor ( value ) {
22
24
super ( ) ;
23
25
26
+ if ( DEV ) {
27
+ if ( ! inited ) {
28
+ inited = true ;
29
+ ReactiveMap . prototype [ INSPECT_SYMBOL ] = function ( ) {
30
+ // changes could either introduced by
31
+ // - modifying the value, or
32
+ // - add / remove entries to the map
33
+ for ( const [ , source ] of this . #sources) {
34
+ get ( source ) ;
35
+ }
36
+ get ( this . #size) ;
37
+ } ;
38
+ }
39
+ }
40
+
24
41
// If the value is invalid then the native exception will fire here
25
42
if ( DEV ) new Map ( value ) ;
26
43
@@ -156,14 +173,4 @@ export class ReactiveMap extends Map {
156
173
get size ( ) {
157
174
return get ( this . #size) ;
158
175
}
159
-
160
- [ INSPECT_SYMBOL ] ( ) {
161
- // changes could either introduced by
162
- // - modifying the value, or
163
- // - add / remove entries to the map
164
- for ( const [ , source ] of this . #sources) {
165
- get ( source ) ;
166
- }
167
- get ( this . #size) ;
168
- }
169
176
}
Original file line number Diff line number Diff line change @@ -67,6 +67,12 @@ export class ReactiveSet extends Set {
67
67
return new ReactiveSet ( set ) ;
68
68
} ;
69
69
}
70
+
71
+ if ( DEV ) {
72
+ proto [ INSPECT_SYMBOL ] = function ( ) {
73
+ get ( this . #version) ;
74
+ } ;
75
+ }
70
76
}
71
77
72
78
#increment_version( ) {
@@ -151,7 +157,4 @@ export class ReactiveSet extends Set {
151
157
get size ( ) {
152
158
return get ( this . #size) ;
153
159
}
154
- [ INSPECT_SYMBOL ] ( ) {
155
- get ( this . #version) ;
156
- }
157
160
}
You can’t perform that action at this time.
0 commit comments