foosel/Octoprint #841: Can't login using IE

Add computed property "name" to function objects if not provided by the
browser, to avoid dropping out of main.js before it is finished.
This commit is contained in:
Mark Walker committed 2015-04-07 00:46:31 -07:00
1 parent b2fc536ba8
commit 68215c6ba9
1 file changed
+10
+10
View File
@@ -57,6 +57,16 @@ $(function() {
// the view model map is our basic look up table for dependencies that may be injected into other view models
var viewModelMap = {};
// Fix Function#name on browsers that do not support it (IE):
// see: http://stackoverflow.com/questions/6903762/function-name-not-supported-in-ie
if (!(function f() {}).name) {
Object.defineProperty(Function.prototype, 'name', {
get: function() {
return this.toString().match(/^\s*function\s*(\S*)\s*\(/)[1];
}
});
}
// helper to create a view model instance with injected constructor parameters from the view model map
var _createViewModelInstance = function(viewModel, viewModelMap){
var viewModelClass = viewModel[0];