Skip to content

Commit

Permalink
修复BroadCastChannel内存泄露问题 (#3288)
Browse files Browse the repository at this point in the history
在同页面中不停的切换,导致内存无法释放,代码片段如下:
data(){
    return {
        BroadcastNotice:new BroadcastChannel('hundsun-notice111111')
    }
},
created() {
    this.BroadcastNotice.onmessage = event => this.$emit("onNoticeMsg", event) //泄露
    // this.HundsunNotice.onmessage = event => {}  //正常

},
  • Loading branch information
yuditxj committed Apr 15, 2022
1 parent edfb727 commit a66e061
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions runtime/services/broadcast-channel/index.js
Expand Up @@ -69,6 +69,7 @@ BroadcastChannel.prototype.close = function () {
}

this._closed = true
this.onmessage = null

// remove itself from channels.
if (channels[this.name]) {
Expand Down

0 comments on commit a66e061

Please sign in to comment.