我正在写一个chrome的插件
先付上源码
https://github.com/KaraMisoRa...中的fetch.js和injection.js
整体构造大致如下
//
function fetch(number) {
var self= this;
this.rowdata= sorteddata[number]
this.ISBN=number;
this.Systemid;
this.Response=number;
if (this.GetISBN()!=undefined) {
this.whichone(number);
this.CombinedURL=this.Combine(ISBN,systemid);
}
}
fetch.prototype.A=function().....
fetch.prototype.B=function()
fetch.prototype.C=function().....
new fetch(0); new fetch(1); new fetch(2)
//
先定义函数,然后用prototype定义几个方法。
然后new了3个实例。
期待的结果当然是最后输出的是三个不同的结果,但最后输出了3个 fetch(2)的结果。
应该是new fetch(2)执行的时候污染了前面两者的变量。
我也尝试了非常多的方法比如闭包,但是并没有作用。
请问在这种情况下如何阻止fetch(0); new fetch(1); new fetch(2)三者的变量互相污染?