Skip to content
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

Does not work with Angular 6 #93

Closed
JustACodeMonkey opened this issue Apr 17, 2018 · 4 comments
Closed

Does not work with Angular 6 #93

JustACodeMonkey opened this issue Apr 17, 2018 · 4 comments

Comments

@JustACodeMonkey
Copy link
Contributor

I'm submitting a ... (check one with "x")

[X ] bug report => search github for a similar issue or PR before submitting
[ ] feature request
[ ] support request => Please do not submit support request here, instead see https://github.com/HackedByChinese/ng2-idle/blob/master/CONTRIBUTING.md#getting-help

Current behavior

Building an application with Angular 6 / Angular 6 CLI fails because Angular 6 required rxjs 6+.

Expected behavior

The application build should not fail

Minimal reproduction of the problem with instructions

Create an Angular 6 application with the Angular 6 CLI. Add @ng-idle/core to the dependencies section of package.json and try to run your application. You will see a series of errors in the format...

Module not found: Error: Can't resolve 'rxjs/Observable' in [.../node_modules/@ng-idle/core/src]

What is the motivation / use case for changing the behavior?

Our applications use @ng-idle/core and @ng-idle/keepalive and we're upgrading to Angular 6

Please tell us about your environment:

Mac OS (newest), VSCode (newest), npm, nodejs

  • @ng-idle version: 2.x

2.0.0-beta.15

  • Angular version: 2.x

Angular 6.0.0-rc.5

  • Browser: [all | Chrome XX | Firefox XX | IE XX | Safari XX | Mobile Chrome XX | Android X.X Web Browser | iOS XX Safari | iOS XX UIWebView | iOS XX WKWebView ]

All

  • Language: [all | TypeScript X.X | ES6/7 | ES5]
    We use TypeScript 2.7.x

  • Node: node --version =
    8.11

@JustACodeMonkey
Copy link
Contributor Author

There aren't too many changes required to make this work with Angular 6.

interrupt.ts (modules/core/src)

eventtargetinterruptsource.ts (modules/core/src)

import { Observable, Subscription, fromEvent, merge } from 'rxjs';
import { filter, throttleTime } from 'rxjs/operators';
  • And then update the old lines (56 to 60) to
const fromEvents = events.split(' ').map(eventName => fromEvent<any>(target, eventName, opts));
this.eventSrc = merge(...fromEvents);
this.eventSrc = this.eventSrc.pipe(
  filter(innerArgs => !this.filterEvent(innerArgs))
);
if (this.throttleDelay > 0) {
  this.eventSrc = this.eventSrc.pipe(
    throttleTime(this.throttleDelay)
  );
}

...I updated the tslint.json file by removing the restriction to import the root of rxjs, and package.json accordingly (to update to newest version of Angular and RxJS).

@dynamics12
Copy link

Any plans on supporting RxJS 6 anytime soon?

@JustACodeMonkey
Copy link
Contributor Author

See the workaround #94

@goat67
Copy link

goat67 commented May 23, 2018

Can we get an updated version for angular 6??

@grbsk grbsk closed this as completed in 4a71953 May 24, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants