Skip to content
This repository has been archived by the owner on Feb 26, 2024. It is now read-only.

fix(webapi): refactor webapi to not import util.ts directly #652

Closed
wants to merge 1 commit into from

Conversation

JiaLiPassion
Copy link
Collaborator

  1. webapi mediaquery, notification should not import methods from util.ts because it will pull all util.ts content into webapi-media-query.js and webapis-notification.js under dist
  2. export some zone util's method through Zone[symbol(methodName)]
  3. add webapis dist/min.js

@@ -23,16 +22,14 @@ import {NestedEventListenerOrEventListenerObject, patchEventTargetMethods} from
handler: args[0],
target: self || _global,
name: 'mediaQuery',
invokeAddFunc: function(
addFnSymbol: any, delegate: Task|NestedEventListenerOrEventListenerObject) {
invokeAddFunc: function(addFnSymbol: any, delegate) {
Copy link
Contributor

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.

Copy link
Collaborator Author

@JiaLiPassion JiaLiPassion Mar 8, 2017

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)

@@ -569,3 +569,15 @@ export function findEventTask(target: any, evtName: string): Task[] {
}
return result;
}

Zone[zoneSymbol('patchEventTargetMethods')] = patchEventTargetMethods;
Copy link
Contributor

Choose a reason for hiding this comment

The 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?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The 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

  • for easier patch other non standard or 3rd party API
  • don't need to import those methods from util.ts

Copy link
Contributor

Choose a reason for hiding this comment

The 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 patchEventTargetMethods

Copy link
Collaborator Author

Choose a reason for hiding this comment

The 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.

mhevery pushed a commit that referenced this pull request Mar 10, 2017
@mhevery mhevery closed this in b7b4c8f Mar 10, 2017
mhevery pushed a commit that referenced this pull request Mar 10, 2017
@JiaLiPassion JiaLiPassion deleted the webapi branch March 17, 2017 03:45
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants