javascript - Why window.setTimeout throws an exception in IE9? -
here's code:
save: function(){ window.settimeout(recipecontrolsviewmodel.savewotimeout(),500); }, here's error in ie9 when "display notification every script error" alternative checked in net options in ie9. doesn't happen in firefox, chrome or ie10 & ie11.
script87: invalid argument does know why happens , how prepare this?
you need wrap function phone call in anonymous function:
save: function(){ window.settimeout(function() { recipecontrolsviewmodel.savewotimeout() },500); }, alternatively, ie9 forwards can utilize .bind():
save: function(){ window.settimeout(recipecontrolsviewmodel.savewotimeout.bind(recipecontrolsviewmodel) },500); }, though in case that's more typing. .bind() function returns function that's "bound" object pass it. means returned function phone call original function (the 1 referred "savewotimeout" property) argument ("recipecontrolsviewmodel") value of this.
javascript internet-explorer-9 settimeout
No comments:
Post a Comment