我正在编写一些使用该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);
};
Run Code Online (Sandbox Code Playgroud)
由于我使用Firefox开发WinXP,有时使用IE 9或10在Win7中进行测试,因此我没有注意到或注意IE8及以下版本不支持的事实bind.
这个特殊的脚本不使用画布,所以我有点犹豫要不要注销所有的IE 8用户.
有标准的解决方法吗?
我在JavaScript中有点好,但我仍然有点像菜鸟.如果解决方案完全明显,请原谅我.
javascript bind cross-browser backwards-compatibility internet-explorer-8