File tree Expand file tree Collapse file tree 1 file changed +3
-6
lines changed
packages/js-draw/src/util Expand file tree Collapse file tree 1 file changed +3
-6
lines changed Original file line number Diff line number Diff line change @@ -91,9 +91,8 @@ export abstract class ReactiveValue<T> {
9191 sourceValues : ReactiveValue < any > [ ] ,
9292 ) : ReactiveValue < T > {
9393 const result = new ReactiveValueImpl ( callback ( ) ) ;
94- const resultRef = ( window as any ) . WeakRef
95- ? new ( window as any ) . WeakRef ( result )
96- : { deref : ( ) => result } ;
94+ const resultRef =
95+ typeof WeakRef !== 'undefined' ? new WeakRef ( result ) : { deref : ( ) => result } ;
9796
9897 for ( const value of sourceValues ) {
9998 const listener = value . onUpdate ( ( ) => {
@@ -179,9 +178,7 @@ export abstract class MutableReactiveValue<T> extends ReactiveValue<T> {
179178 propertyName : Name ,
180179 ) : MutableReactiveValue < SourceType [ Name ] > {
181180 const child = ReactiveValue . fromInitialValue ( sourceValue . get ( ) [ propertyName ] ) ;
182- const childRef = ( window as any ) . WeakRef
183- ? new ( window as any ) . WeakRef ( child )
184- : { deref : ( ) => child } ;
181+ const childRef = typeof WeakRef !== 'undefined' ? new WeakRef ( child ) : { deref : ( ) => child } ;
185182
186183 // When the source is updated...
187184 const sourceListener = sourceValue . onUpdate ( ( newValue ) => {
You can’t perform that action at this time.
0 commit comments