diff --git a/package.json b/package.json index 3e2a00f0..86e2cf85 100644 --- a/package.json +++ b/package.json @@ -35,9 +35,9 @@ "default": "./Mount.js", "types": "./Mount.ts" }, - "./yield.js": { - "default": "./yield.js", - "types": "./yield.ts" + "./weave.js": { + "default": "./weave.js", + "types": "./weave.ts" }, "./Object$tring.js": "./Object$tring.js", "./Object$entences.js": "./Object$entences.js", diff --git a/tsconfig.json b/tsconfig.json index cfca5ab3..f102715e 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -29,7 +29,7 @@ "positractions/*", "funions/Localizer.ts", "asmr/*", - "yield.ts" + "weave.ts" ], "exclude":[ "node_modules/*" diff --git a/yield.js b/weave.js similarity index 72% rename from yield.js rename to weave.js index c76cc246..d4fc08cf 100644 --- a/yield.js +++ b/weave.js @@ -1,26 +1,26 @@ -export const yields = new Map(); -export async function y(schema) { - return new Yield(schema); +const values = new Map(); +export async function weave(schema) { + return new Weave(schema); } -export async function a(guid) { - if (yields.has(guid)) - return yields.get(guid); +export async function when(guid) { + if (values.has(guid)) + return values.get(guid); const { waitForEvent } = await import('./lib/waitForEvent.js'); await waitForEvent(window, guid); - return yields.get(guid); + return values.get(guid); } -export class Yield { +export class Weave { schema; constructor(schema) { this.schema = schema; } #to; - async to(guid) { - if (yields.has(guid)) + async into(guid) { + if (values.has(guid)) return; this.#to = guid; const objToPipe = await this.#yield(); - yields.set(guid, objToPipe); + values.set(guid, objToPipe); window.dispatchEvent(new Event(guid)); } async #yield() { diff --git a/yield.ts b/weave.ts similarity index 71% rename from yield.ts rename to weave.ts index a7e1d044..47c9254a 100644 --- a/yield.ts +++ b/weave.ts @@ -1,27 +1,27 @@ import { USLMapping } from './ts-refs/trans-render/XV/types.js'; -export const yields: Map = new Map(); +const values: Map = new Map(); -export async function y(schema: USLMapping){ - return new Yield(schema); +export async function weave(schema: USLMapping){ + return new Weave(schema); } -export async function a(guid: string){ - if(yields.has(guid)) return yields.get(guid); +export async function when(guid: string){ + if(values.has(guid)) return values.get(guid); const {waitForEvent} = await import('./lib/waitForEvent.js'); await waitForEvent(window, guid); - return yields.get(guid); + return values.get(guid); } -export class Yield { +export class Weave { constructor(public schema: USLMapping){} #to: string | undefined; - async to(guid: string){ - if(yields.has(guid)) return; + async into(guid: string){ + if(values.has(guid)) return; this.#to = guid; const objToPipe = await this.#yield(); - yields.set(guid, objToPipe); + values.set(guid, objToPipe); window.dispatchEvent(new Event(guid)); }