File tree Expand file tree Collapse file tree
packages/svelte/src/reactivity Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ import { DEV } from 'esm-env' ;
12import { INSPECT_SYMBOL } from '../internal/client/constants.js' ;
23import { source , set } from '../internal/client/reactivity/sources.js' ;
34import { get } from '../internal/client/runtime.js' ;
@@ -89,6 +90,12 @@ export class ReactiveDate extends Date {
8990 return v ;
9091 } ;
9192 }
93+
94+ if ( DEV ) {
95+ proto [ INSPECT_SYMBOL ] = function ( ) {
96+ get ( this . #raw_time) ;
97+ } ;
98+ }
9299 }
93100 }
94101
@@ -100,8 +107,4 @@ export class ReactiveDate extends Date {
100107 super ( ...values ) ;
101108 this . #init( ) ;
102109 }
103-
104- [ INSPECT_SYMBOL ] ( ) {
105- get ( this . #raw_time) ;
106- }
107110}
Original file line number Diff line number Diff line change @@ -5,6 +5,8 @@ import { UNINITIALIZED } from '../constants.js';
55import { map } from './utils.js' ;
66import { INSPECT_SYMBOL } from '../internal/client/constants.js' ;
77
8+ var inited = false ;
9+
810/**
911 * @template K
1012 * @template V
@@ -21,6 +23,21 @@ export class ReactiveMap extends Map {
2123 constructor ( value ) {
2224 super ( ) ;
2325
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+
2441 // If the value is invalid then the native exception will fire here
2542 if ( DEV ) new Map ( value ) ;
2643
@@ -156,14 +173,4 @@ export class ReactiveMap extends Map {
156173 get size ( ) {
157174 return get ( this . #size) ;
158175 }
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- }
169176}
Original file line number Diff line number Diff line change @@ -67,6 +67,12 @@ export class ReactiveSet extends Set {
6767 return new ReactiveSet ( set ) ;
6868 } ;
6969 }
70+
71+ if ( DEV ) {
72+ proto [ INSPECT_SYMBOL ] = function ( ) {
73+ get ( this . #version) ;
74+ } ;
75+ }
7076 }
7177
7278 #increment_version( ) {
@@ -151,7 +157,4 @@ export class ReactiveSet extends Set {
151157 get size ( ) {
152158 return get ( this . #size) ;
153159 }
154- [ INSPECT_SYMBOL ] ( ) {
155- get ( this . #version) ;
156- }
157160}
You can’t perform that action at this time.
0 commit comments