Skip to content

Instantly share code, notes, and snippets.

@johgusta
Last active December 15, 2016 17:03
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save johgusta/46fb1ecd459dbc3bfdfc to your computer and use it in GitHub Desktop.
Save johgusta/46fb1ecd459dbc3bfdfc to your computer and use it in GitHub Desktop.
Disable JIT compiler on Safari for $new
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;
}]);
}
}]);
@skusunam
Copy link

@johgusta Which version of Angular did you try?

@TiagoSilvaPereira
Copy link

How to make it in Angular2?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment