Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F2920229
weakref.js
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
658 B
Referenced Files
None
Subscribers
None
weakref.js
View Options
import
{
test
,
summary
}
from
'./helpers.js'
;
console
.
log
(
'WeakRef Tests\n'
);
const
obj1
=
{
name
:
'test'
};
const
ref1
=
new
WeakRef
(
obj1
);
test
(
'weakref deref returns target'
,
ref1
.
deref
()
===
obj1
,
true
);
test
(
'weakref deref value'
,
ref1
.
deref
().
name
,
'test'
);
const
obj2
=
{
value
:
42
};
const
ref2
=
new
WeakRef
(
obj2
);
test
(
'weakref deref number value'
,
ref2
.
deref
().
value
,
42
);
const
obj3
=
{};
const
ref3
=
new
WeakRef
(
obj3
);
test
(
'weakref has deref method'
,
typeof
ref3
.
deref
,
'function'
);
test
(
'weakref instanceof'
,
ref3
instanceof
WeakRef
,
true
);
test
(
'weakref prototype'
,
Object
.
getPrototypeOf
(
ref3
)
===
WeakRef
.
prototype
,
true
);
summary
();
File Metadata
Details
Attached
Mime Type
application/javascript
Expires
Fri, Mar 27, 6:14 AM (2 d)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
512556
Default Alt Text
weakref.js (658 B)
Attached To
Mode
rANT Ant
Attached
Detach File
Event Timeline
Log In to Comment