我正在编写一些使用该Object.bind
方法的 JavaScript 。
funcabc = function(x, y, z){
this.myx = x;
this.playUB = function(w) {
if ( this.myx === null ) {
// do blah blah
return;
}
// do other stuff
};
this.play = this.playUB.bind(this);
};
由于我在WinXP下用Firefox开发,有时在Win7下用IE 9或10进行测试,我没有注意到或注意IE8及以下不支持bind
.
这个特定的脚本不使用画布,所以我有点犹豫要不要注销所有 IE 8 用户。
有标准的解决方法吗?
我在 JavaScript 方面做得还不错,但我仍然有点菜鸟。所以如果解决方案是完全显而易见的,请原谅我。