andynewman
andynewman

Reputation: 345

Accessing WorkerGlobalScope instance in web Worker using package:web

When writing a Web worker using Dart, using the now deprecated dart:html package, it is possible to access the WorkerGlobalScope instance this way:

import 'dart:html'; // deprecated

void test() {
  WorkerGlobalScope.instance.importScripts("...");
}

Using package:web, how can I do the same?

import 'package:web/web.dart' as web;

void test() {
  web.WorkerGlobalScope.instance // not working. 
}

I see WorkerGlobalScope is defined in package:web's lib/src/dom/html.dart file, suggesting Worker APIs are supported. But WorkerGlobalScope is an extension, not a class. How can I use it?

There is a severe lack of documentation on package:web.

Upvotes: 1

Views: 52

Answers (0)

Related Questions