UNPKG
weaked
Version:
latest (0.1.3)
0.1.3
0.1.2
0.1.1
0.1.0
weak decorator, wraps it with a WeakRef descriptor
github.com/jaenster/weaked
jaenster/weaked
weaked
/
readme.md
24 lines
(18 loc)
•
324 B
Markdown
View Raw
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# Weakrefs
as
decorator ```typescript
class
Foo
{
@Weaked()
bar: Bar;
constructor
(bar) {
this
.bar = bar; } }
class
Bar
{ baz() {
return
5
; } }
const
foo = new Foo(bar);
// This is derefed automaticly for your ease of coding
console.log(foo.bar?.baz()); ```