第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定
已解決430363個(gè)問題,去搜搜看,總會(huì)有你想問的

JS 引起內(nèi)存泄漏問題

JS 引起內(nèi)存泄漏問題

一只萌萌小番薯 2019-03-05 13:19:15
代碼如下:document.onload = (function() {    var GraphCreator = function(name) {        var thisGraph = this;        console.log(thisGraph);        this.name = name || '';    };    GraphCreator.prototype.setName = function(name) {        var thisGraph = this;        thisGraph.name = name;    };    GraphCreator.prototype.addTab = function(data) {        var content = document.getElementById('content');        var tab = juicer($('#extended_tpl').html(), data);        content.append(tab);    };    window.GraphCreator = GraphCreator;})();var graph = new GraphCreator();graph.setName('graph_one');這樣寫會(huì)引起內(nèi)存泄漏嗎?哪些地方是不合理的?
查看完整描述

2 回答

?
RISEBY

TA貢獻(xiàn)1856條經(jīng)驗(yàn) 獲得超5個(gè)贊

document.onload才對(duì)吧,而且后面應(yīng)該不是一個(gè)自執(zhí)行吧

要么(function())(),要么document.onload=function()

在外部庫(kù)引用正確的話,感覺沒什么問題


查看完整回答
反對(duì) 回復(fù) 2019-03-16
?
當(dāng)年話下

TA貢獻(xiàn)1890條經(jīng)驗(yàn) 獲得超9個(gè)贊

閉包就是一個(gè)函數(shù)引用另外一個(gè)函數(shù)的變量,你確定你有閉包?


查看完整回答
反對(duì) 回復(fù) 2019-03-16
  • 2 回答
  • 0 關(guān)注
  • 481 瀏覽
慕課專欄
更多

添加回答

舉報(bào)

0/150
提交
取消
微信客服

購(gòu)課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)