mirror of
https://github.com/MercuryWorkshop/scramjet.git
synced 2025-05-16 15:40:02 -04:00
zoops
This commit is contained in:
parent
4ac0fce534
commit
8666196db3
2 changed files with 5 additions and 4 deletions
|
@ -1,11 +1,11 @@
|
|||
import { ScramjetClient } from "../client";
|
||||
|
||||
export default function (client: ScramjetClient, self: typeof window) {
|
||||
client.serviceworker.addEventListener("message", ({ data }) => {
|
||||
client.serviceWorker.addEventListener("message", ({ data }) => {
|
||||
if (!("scramjet$type" in data)) return;
|
||||
|
||||
if (data.scramjet$type === "cookie") {
|
||||
this.cookieStore.setCookies([data.cookie], new URL(data.url));
|
||||
client.cookieStore.setCookies([data.cookie], new URL(data.url));
|
||||
return;
|
||||
}
|
||||
});
|
||||
|
@ -17,8 +17,7 @@ export default function (client: ScramjetClient, self: typeof window) {
|
|||
set(ctx, value: string) {
|
||||
client.cookieStore.setCookies([value], client.url);
|
||||
|
||||
// TODO hardcode because scoping whatever
|
||||
client.serviceworker.controller!.postMessage({
|
||||
client.serviceWorker.controller!.postMessage({
|
||||
scramjet$type: "cookie",
|
||||
cookie: value,
|
||||
url: client.url.href,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue