Skip to content

Commit 4fa07a9

Browse files
authored
add checks for message channel usage in web runtime (#142)
1 parent 1ba1683 commit 4fa07a9

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

packages/runtime/src/Context.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,15 +92,19 @@ class NodejsWaitingRequestCounter {
9292

9393
public increase (): void {
9494
if (this.count === 0) {
95-
this.refHandle.ref()
95+
if (this.refHandle.ref) {
96+
this.refHandle.ref()
97+
}
9698
}
9799
this.count++
98100
}
99101

100102
public decrease (): void {
101103
if (this.count === 0) return
102104
if (this.count === 1) {
103-
this.refHandle.unref()
105+
if (this.refHandle.unref) {
106+
this.refHandle.unref()
107+
}
104108
}
105109
this.count--
106110
}

0 commit comments

Comments
 (0)