Last active
December 15, 2016 17:03
-
-
Save johgusta/46fb1ecd459dbc3bfdfc to your computer and use it in GitHub Desktop.
Disable JIT compiler on Safari for $new
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
angular.module('lib.decorators', []) | |
.config(['$provide', function($provide){ | |
'use strict'; | |
var isSafari = /Safari/.test(navigator.userAgent) && /Apple Computer/.test(navigator.vendor); | |
if(isSafari) { | |
$provide.decorator('$rootScope', ['$delegate', function($rootScope) { | |
var scopePrototype = Object.getPrototypeOf($rootScope); | |
var originalScopeNew = scopePrototype.$new; | |
scopePrototype.$new = function () { | |
try { | |
return originalScopeNew.apply(this, arguments); | |
} catch(e) { | |
console.error(e); | |
throw e; | |
} | |
}; | |
return $rootScope; | |
}]); | |
} | |
}]); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
How to make it in Angular2?