-
Notifications
You must be signed in to change notification settings - Fork 6.8k
feat: support lazy-loading HammerJS w/ Angular 6.1 #11960
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
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.
LGTM
// If HammerJS is not loaded here, return the noop HammerInstance. This is necessary to | ||
// ensure that omitting HammerJS completely will not cause any errors while *also* supporting | ||
// the lazy-loading of HammerJS via the HAMMER_LOADER token introduced in Angular 6.1. | ||
// Because we can't depend on HAMMER_LOADER's existance until 7.0, we have to always set |
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.
Can you add an @deletion-target
for 7.0 here so we remember to update it once 7.0 is out?
Blocked by angular/angular#24682 |
@@ -44,12 +44,35 @@ describe('GestureConfig', () => { | |||
expect(firstCallArgs[1].cssProps.touchAction).toBe('auto'); | |||
}); | |||
|
|||
it('should should not error when HammerJS is not loaded', () => { |
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.
Jar jar binks
@josephperrott unblocked now that the requisite Angular change is synced |
Angular 6.1 adds the HAMMER_LOADER token that can be used to lazy-load HammerJS. This commit updates Angular Material's gesture config to be compatible with lazy-loading HammerJS by: * Only reading `window.Hammer` after Angular knows that HammerJS has been loaded. * Always registering the set of gesture events used in the Angular Material components (instead of registering no events when Hammer is absent). Once we are able to depend on HAMMER_LOADER itself (in v7.0), this can be simplified a bit.
Jar jar binks lives on! |
Angular 6.1 adds the HAMMER_LOADER token that can be used to lazy-load HammerJS. This commit updates Angular Material's gesture config to be compatible with lazy-loading HammerJS by: * Only reading `window.Hammer` after Angular knows that HammerJS has been loaded. * Always registering the set of gesture events used in the Angular Material components (instead of registering no events when Hammer is absent). Once we are able to depend on HAMMER_LOADER itself (in v7.0), this can be simplified a bit.
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
Angular 6.1 adds the HAMMER_LOADER token that can be used to lazy-load
HammerJS. This commit updates Angular Material's gesture config to be
compatible with lazy-loading HammerJS by:
window.Hammer
after Angular knows that HammerJS hasbeen loaded.
Material components (instead of registering no events when Hammer is
absent).
Once we are able to depend on HAMMER_LOADER itself (in v7.0), this can
be simplified a bit.