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

Cannot read property 'new' of undefined #22

Open
ThebaultLouis opened this issue Jun 18, 2019 · 1 comment
Open

Cannot read property 'new' of undefined #22

ThebaultLouis opened this issue Jun 18, 2019 · 1 comment

Comments

@ThebaultLouis
Copy link

Hello,
I am getting errors in the example.
I just changed
import 'package:service_worker/service_worker.dart';
to
import 'package:service_worker/worker.dart';

And I am getting the following in the web console:
`
MAIN: registereddart_sdk.js:18740
MAIN: ready dart_sdk.js:18740
MAIN: Sending message: Sample message: 2019-06-18 10:52:26.908 dart_sdk.js:18740
MAIN: Message sent: Sample message: 2019-06-18 10:52:26.908 main.dart:34

Uncaught (in promise) TypeError: Cannot read property 'new' of undefined
`

Where new is used there:

var subs = await registration.pushManager .subscribe(new sw.PushSubscriptionOptions(userVisibleOnly: true));

@isoos
Copy link
Owner

isoos commented Jun 18, 2019

AFAICR worker is for on-page web worker, and with that it may not have access to the pushManager. But my memory is really vague on this one, I haven't done deep web coding for ages...

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

2 participants