-
Notifications
You must be signed in to change notification settings - Fork 409
fix(webapi): refactor webapi to not import util.ts directly #652
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -569,3 +569,15 @@ export function findEventTask(target: any, evtName: string): Task[] { | |
} | ||
return result; | ||
} | ||
|
||
Zone[zoneSymbol('patchEventTargetMethods')] = patchEventTargetMethods; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I feel very uneasy with exposing these APIs even if they are behind a symbol. What is the reasoning? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes,I feel the same,the reason to expose those API in such way is
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think we should expose the minimal set. I will remove the rest of the exports and just keep There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. sure, mediaQuery use patchEventTargetMethods, and Notification use patchOnProperties. I will leave those two and remove others. |
||
Zone[zoneSymbol('patchMicroTask')] = patchMicroTask; | ||
Zone[zoneSymbol('patchMacroTask')] = patchMacroTask; | ||
Zone[zoneSymbol('patchClass')] = patchClass; | ||
Zone[zoneSymbol('patchProperty')] = patchProperty; | ||
Zone[zoneSymbol('patchOnProperties')] = patchOnProperties; | ||
Zone[zoneSymbol('isNode')] = isNode; | ||
Zone[zoneSymbol('isBrowser')] = isBrowser; | ||
Zone[zoneSymbol('isMix')] = isMix; | ||
Zone[zoneSymbol('isWebWorker')] = isWebWorker; | ||
Zone[zoneSymbol('findEventTask')] = findEventTask; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
/** | ||
* @license | ||
* Copyright Google Inc. All Rights Reserved. | ||
* | ||
* Use of this source code is governed by an MIT-style license that can be | ||
* found in the LICENSE file at https://angular.io/license | ||
*/ | ||
|
||
import '../../lib/browser/webapis-notification'; | ||
|
||
import {zoneSymbol} from '../../lib/common/utils'; | ||
import {ifEnvSupports} from '../test-util'; | ||
|
||
function notificationSupport() { | ||
const desc = window['Notification'] && | ||
Object.getOwnPropertyDescriptor(window['Notification'].prototype, 'onerror'); | ||
return window['Notification'] && window['Notification'].prototype && desc.configurable; | ||
} | ||
|
||
(<any>notificationSupport).message = 'Notification Support'; | ||
|
||
describe('Notification API', ifEnvSupports(notificationSupport, function() { | ||
it('Notification API should be patched by Zone', () => { | ||
const Notification = window['Notification']; | ||
expect(Notification.prototype[zoneSymbol('addEventListener')]).toBeTruthy(); | ||
}); | ||
})); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why are you removing the types? That does not seem right.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The reason is I don't want to import the type from until.ts which will drag all contents from util.ts when rollup build. Just like the review here,#631 (review)