(Zone: ZoneType)
| 29 | import {propertyDescriptorPatch} from './property-descriptor'; |
| 30 | |
| 31 | export function patchBrowser(Zone: ZoneType): void { |
| 32 | Zone.__load_patch('timers', (global: any) => { |
| 33 | const set = 'set'; |
| 34 | const clear = 'clear'; |
| 35 | patchTimer(global, set, clear, 'Timeout'); |
| 36 | patchTimer(global, set, clear, 'Interval'); |
| 37 | patchTimer(global, set, clear, 'Immediate'); |
| 38 | }); |
| 39 | |
| 40 | Zone.__load_patch('requestAnimationFrame', (global: any) => { |
| 41 | patchTimer(global, 'request', 'cancel', 'AnimationFrame'); |
| 42 | patchTimer(global, 'mozRequest', 'mozCancel', 'AnimationFrame'); |
| 43 | patchTimer(global, 'webkitRequest', 'webkitCancel', 'AnimationFrame'); |
| 44 | }); |
| 45 | |
| 46 | Zone.__load_patch('blocking', (global: any, Zone: ZoneType) => { |
| 47 | const blockingMethods = ['alert', 'prompt', 'confirm']; |
| 48 | for (let i = 0; i < blockingMethods.length; i++) { |
| 49 | const name = blockingMethods[i]; |
| 50 | patchMethod(global, name, (delegate, symbol, name) => { |
| 51 | return function (s: any, args: any[]) { |
| 52 | return Zone.current.run(delegate, global, args, name); |
| 53 | }; |
| 54 | }); |
| 55 | } |
| 56 | }); |
| 57 | |
| 58 | Zone.__load_patch('EventTarget', (global: any, Zone: ZoneType, api: _ZonePrivate) => { |
| 59 | patchEvent(global, api); |
| 60 | eventTargetPatch(global, api); |
| 61 | // patch XMLHttpRequestEventTarget's addEventListener/removeEventListener |
| 62 | const XMLHttpRequestEventTarget = (global as any)['XMLHttpRequestEventTarget']; |
| 63 | if (XMLHttpRequestEventTarget && XMLHttpRequestEventTarget.prototype) { |
| 64 | api.patchEventTarget(global, api, [XMLHttpRequestEventTarget.prototype]); |
| 65 | } |
| 66 | }); |
| 67 | |
| 68 | Zone.__load_patch('MutationObserver', (global: any, Zone: ZoneType, api: _ZonePrivate) => { |
| 69 | patchClass('MutationObserver'); |
| 70 | patchClass('WebKitMutationObserver'); |
| 71 | }); |
| 72 | |
| 73 | Zone.__load_patch('IntersectionObserver', (global: any, Zone: ZoneType, api: _ZonePrivate) => { |
| 74 | patchClass('IntersectionObserver'); |
| 75 | }); |
| 76 | |
| 77 | Zone.__load_patch('FileReader', (global: any, Zone: ZoneType, api: _ZonePrivate) => { |
| 78 | patchClass('FileReader'); |
| 79 | }); |
| 80 | |
| 81 | Zone.__load_patch('on_property', (global: any, Zone: ZoneType, api: _ZonePrivate) => { |
| 82 | propertyDescriptorPatch(api, global); |
| 83 | }); |
| 84 | |
| 85 | Zone.__load_patch('customElements', (global: any, Zone: ZoneType, api: _ZonePrivate) => { |
| 86 | patchCustomElements(global, api); |
| 87 | }); |
| 88 |
no test coverage detected
searching dependent graphs…