Skip to content

Commit

Permalink
slintpad: Remove service worker again
Browse files Browse the repository at this point in the history
Now that the compiler does the resource URL mapping, we do not urgently
need the service worker anymore.

Closes: slint-ui#2905
  • Loading branch information
hunger authored and ogoffart committed Nov 3, 2023
1 parent d53cebd commit ada7d61
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 25 deletions.
1 change: 0 additions & 1 deletion tools/slintpad/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@
"rimraf": "^5.0.0",
"typescript": "^5.0.4",
"vite": "^4.3.3",
"vite-plugin-pwa": "^0.16.4",
"vscode": "npm:@codingame/monaco-vscode-api@1.81.7",
"vscode-languageclient": "~8.1.0",
"vscode-languageserver": "~8.1.0",
Expand Down
23 changes: 0 additions & 23 deletions tools/slintpad/src/editor_widget.ts
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,6 @@ class EditorPaneWidget extends Widget {
#disposables: monaco.IDisposable[] = [];
#internal_uuid = self.crypto.randomUUID();

#service_worker_port: MessagePort;
#extra_file_urls: { [key: string]: string } = {};

onPositionChangeCallback: PositionChangeCallback = (
Expand Down Expand Up @@ -271,27 +270,6 @@ class EditorPaneWidget extends Widget {
monaco.editor.onDidCreateModel((model: monaco.editor.ITextModel) =>
this.add_model_listener(model),
);

const sw_channel = new MessageChannel();
sw_channel.port1.onmessage = (m) => {
if (m.data.type === "MapUrl") {
console.log("REMOVE THE SERVICE WORKER AGAIN");
} else {
console.error(
"Unknown message received from service worker:",
m.data,
);
}
};
if (navigator.serviceWorker.controller == null) {
console.error("No active service worker!");
} else {
navigator.serviceWorker.controller.postMessage(
{ type: "EditorOpened", url_prefix: this.internal_url_prefix },
[sw_channel.port2],
);
}
this.#service_worker_port = sw_channel.port1;
}

async map_url(url_: string): Promise<string | undefined> {
Expand Down Expand Up @@ -321,7 +299,6 @@ class EditorPaneWidget extends Widget {
}

dispose() {
this.#service_worker_port.close();
this.#disposables.forEach((d: monaco.IDisposable) => d.dispose());
this.#disposables = [];
this.#editor?.dispose();
Expand Down
1 change: 0 additions & 1 deletion tools/slintpad/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
// cSpell: ignore lumino

import { defineConfig, UserConfig } from "vite";
import { VitePWA } from "vite-plugin-pwa";
import { resolve } from "path";

export default defineConfig(() => {
Expand Down

0 comments on commit ada7d61

Please sign in to comment.