Forked from IgorMinar/angular-ios9-uiwebview.patch.js
Created
November 10, 2015 22:08
-
-
Save davidbaiguini/1f1214f3b5371b9c2012 to your computer and use it in GitHub Desktop.
Revisions
-
IgorMinar revised this gist
Sep 18, 2015 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -1,5 +1,5 @@ /** * ================== angular-ios9-uiwebview.patch.js v1.1.1 ================== * * This patch works around iOS9 UIWebView regression that causes infinite digest * errors in Angular. -
IgorMinar revised this gist
Sep 18, 2015 . 1 changed file with 5 additions and 3 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -8,7 +8,7 @@ * have the workaround baked in. * * To apply this patch load/bundle this file with your application and add a * dependency on the "ngIOS9UIWebViewPatch" module to your main app module. * * For example: * @@ -34,7 +34,9 @@ * License: MIT */ angular.module('ngIOS9UIWebViewPatch', ['ng']).config(['$provide', function($provide) { 'use strict'; $provide.decorator('$browser', ['$delegate', '$window', function($delegate, $window) { if (isIOS9UIWebView($window.navigator.userAgent)) { @@ -70,4 +72,4 @@ angular.module('ngIOS9UIWebViewPatch', ['ng']).config(function($provide) { return browser; } }]); }]); -
IgorMinar revised this gist
Sep 11, 2015 . 1 changed file with 13 additions and 11 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -1,12 +1,14 @@ /** * ================== angular-ios9-uiwebview.patch.js v1.1.0 ================== * * This patch works around iOS9 UIWebView regression that causes infinite digest * errors in Angular. * * The patch can be applied to Angular 1.2.0 – 1.4.5. Newer versions of Angular * have the workaround baked in. * * To apply this patch load/bundle this file with your application and add a * dependency on the "ngIOS9Patch" module to your main app module. * * For example: * @@ -47,15 +49,15 @@ angular.module('ngIOS9UIWebViewPatch', ['ng']).config(function($provide) { function applyIOS9Shim(browser) { var pendingLocationUrl = null; var originalUrlFn= browser.url; browser.url = function() { if (arguments.length) { pendingLocationUrl = arguments[0]; return originalUrlFn.apply(browser, arguments); } return pendingLocationUrl || originalUrlFn.apply(browser, arguments); }; window.addEventListener('popstate', clearPendingLocationUrl, false); @@ -65,7 +67,7 @@ angular.module('ngIOS9UIWebViewPatch', ['ng']).config(function($provide) { pendingLocationUrl = null; } return browser; } }]); }); -
IgorMinar revised this gist
Sep 11, 2015 . 1 changed file with 3 additions and 1 deletion.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -1,4 +1,6 @@ /** * ============================ angular-ios9-uiwebview.patch.js v1.0.3 ============================ * * This patch works around iOS9 UIWebView regression that causes infinite digest errors in Angular. * * The patch can be applied to Angular 1.2.0 – 1.4.5. Newer versions of Angular have the workaround baked in. @@ -40,7 +42,7 @@ angular.module('ngIOS9UIWebViewPatch', ['ng']).config(function($provide) { return $delegate; function isIOS9UIWebView(userAgent) { return /(iPhone|iPad|iPod).* OS 9_\d/.test(userAgent) && !/Version\/9\./.test(userAgent); } function applyIOS9Shim(browser) { -
IgorMinar revised this gist
Sep 11, 2015 . 1 changed file with 28 additions and 26 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -30,38 +30,40 @@ * License: MIT */ angular.module('ngIOS9UIWebViewPatch', ['ng']).config(function($provide) { $provide.decorator('$browser', ['$delegate', '$window', function($delegate, $window) { if (isIOS9UIWebView($window.navigator.userAgent)) { return applyIOS9Shim($delegate); } return $delegate; function isIOS9UIWebView(userAgent) { return /(iPhone|iPad|iPod) OS 9_\d/.test(userAgent) && !/Version\/9\./.test(userAgent); } function applyIOS9Shim(browser) { var pendingLocationUrl = null; var patchedBrowser = Object.create(browser); patchedBrowser.url = function() { if (arguments.length) { pendingLocationUrl = arguments[0]; return browser.url.apply(patchedBrowser, arguments); } return pendingLocationUrl || browser.url(); }; window.addEventListener('popstate', clearPendingLocationUrl, false); window.addEventListener('hashchange', clearPendingLocationUrl, false); function clearPendingLocationUrl() { pendingLocationUrl = null; } return patchedBrowser; } }]); }); -
IgorMinar created this gist
Sep 11, 2015 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,67 @@ /** * This patch works around iOS9 UIWebView regression that causes infinite digest errors in Angular. * * The patch can be applied to Angular 1.2.0 – 1.4.5. Newer versions of Angular have the workaround baked in. * * To apply this patch load/bundle this file with your application and add a dependency on the "ngIOS9Patch" module * to your main app module. * * For example: * * ``` * angular.module('myApp', ['ngRoute'])` * ``` * * becomes * * ``` * angular.module('myApp', ['ngRoute', 'ngIOS9UIWebViewPatch']) * ``` * * * More info: * - https://openradar.appspot.com/22186109 * - https://github.com/angular/angular.js/issues/12241 * - https://github.com/driftyco/ionic/issues/4082 * * * @license AngularJS * (c) 2010-2015 Google, Inc. http://angularjs.org * License: MIT */ angular.module('ngIOS9UIWebViewPatch', ['ng']).decorator('$browser', ['$delegate', '$window', function($delegate, $window) { if (isIOS9UIWebView($window.navigator.userAgent)) { return applyIOS9Shim($delegate); } return $delegate; function isIOS9UIWebView(userAgent) { return /(iPhone|iPad|iPod) OS 9_\d/.test(userAgent) && !/Version\/9\./.test(userAgent); } function applyIOS9Shim(browser) { var pendingLocationUrl = null; var patchedBrowser = Object.create(browser); patchedBrowser.url = function() { if (arguments.length) { pendingLocationUrl = arguments[0]; return browser.url.apply(patchedBrowser, arguments); } return pendingLocationUrl || browser.url(); }; window.addEventListener('popstate', clearPendingLocationUrl, false); window.addEventListener('hashchange', clearPendingLocationUrl, false); function clearPendingLocationUrl() { pendingLocationUrl = null; } return patchedBrowser; } }]);