Rename Dataspace.global to Dataspace.local
This commit is contained in:
parent
40bc9aadd3
commit
4a05bbad73
|
@ -46,17 +46,16 @@ export class DataspaceObserver implements IndexObserver<Turn> {
|
||||||
}
|
}
|
||||||
|
|
||||||
export class Dataspace implements Partial<Entity> {
|
export class Dataspace implements Partial<Entity> {
|
||||||
private static _global: Ref | undefined = void 0;
|
private static _local: Ref | undefined = void 0;
|
||||||
|
|
||||||
static get global(): Ref {
|
static get local(): Ref {
|
||||||
if (Dataspace._global === void 0) {
|
if (Dataspace._local === void 0) {
|
||||||
Dataspace.boot(ds => {
|
Dataspace.boot(ds => {
|
||||||
Turn.activeFacet.actor.name = Symbol.for('Dataspace.global');
|
Turn.activeFacet.actor.name = Symbol.for('Dataspace.local');
|
||||||
// Cast to any because `global` is otherwise readonly (!)
|
Dataspace._local = ds;
|
||||||
Dataspace._global = ds;
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
return Dataspace._global!;
|
return Dataspace._local!;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Alias for syndicatec code generator to use, plus hook for fallback use outside a Turn
|
// Alias for syndicatec code generator to use, plus hook for fallback use outside a Turn
|
||||||
|
@ -73,7 +72,7 @@ export class Dataspace implements Partial<Entity> {
|
||||||
if (Turn.active) {
|
if (Turn.active) {
|
||||||
return Turn.active._spawn(bootProc);
|
return Turn.active._spawn(bootProc);
|
||||||
} else {
|
} else {
|
||||||
return Actor.boot(bootProc, void 0, Dataspace.global.relay.actor.space);
|
return Actor.boot(bootProc, void 0, Dataspace.local.relay.actor.space);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -11,7 +11,7 @@ export type UIFragmentRecord = ReturnType<typeof P.UIFragment>;
|
||||||
import { HtmlFragments } from "./html";
|
import { HtmlFragments } from "./html";
|
||||||
export * from "./html";
|
export * from "./html";
|
||||||
|
|
||||||
export function boot(ds = Dataspace.global) {
|
export function boot(ds = Dataspace.local) {
|
||||||
spawnGlobalEventFactory(ds);
|
spawnGlobalEventFactory(ds);
|
||||||
spawnWindowEventFactory(ds);
|
spawnWindowEventFactory(ds);
|
||||||
spawnUIFragmentFactory(ds);
|
spawnUIFragmentFactory(ds);
|
||||||
|
|
|
@ -8,7 +8,7 @@ export { HtmlTemplater, template, HtmlFragment } from "./html";
|
||||||
export assertion type LocationHash(hash: string);
|
export assertion type LocationHash(hash: string);
|
||||||
export type LocationHash = ReturnType<typeof LocationHash>;
|
export type LocationHash = ReturnType<typeof LocationHash>;
|
||||||
|
|
||||||
export function boot(ds = Dataspace.global) {
|
export function boot(ds = Dataspace.local) {
|
||||||
spawnLocationHashTracker(ds);
|
spawnLocationHashTracker(ds);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,7 @@ import Pos = Syntax.Pos;
|
||||||
|
|
||||||
import * as Syndicate from '@syndicate-lang/core';
|
import * as Syndicate from '@syndicate-lang/core';
|
||||||
Object.defineProperty(globalThis, 'currentSyndicateTarget', {
|
Object.defineProperty(globalThis, 'currentSyndicateTarget', {
|
||||||
value: Syndicate.Dataspace.global,
|
value: Syndicate.Dataspace.local,
|
||||||
writable: false,
|
writable: false,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -20,7 +20,7 @@ export function sleep(ds: Ref, seconds: number, cb: () => void): void {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export function boot(ds = Dataspace.global) {
|
export function boot(ds = Dataspace.local) {
|
||||||
spawn named 'timer/PeriodicTick' {
|
spawn named 'timer/PeriodicTick' {
|
||||||
at ds {
|
at ds {
|
||||||
during Observe({
|
during Observe({
|
||||||
|
|
|
@ -39,7 +39,7 @@ type TransportState = {
|
||||||
peer: Ref,
|
peer: Ref,
|
||||||
};
|
};
|
||||||
|
|
||||||
export function boot(ds = Dataspace.global, debug: boolean = false, WebSocketConstructor?: typeof WebSocket) {
|
export function boot(ds = Dataspace.local, debug: boolean = false, WebSocketConstructor?: typeof WebSocket) {
|
||||||
spawn named 'transportConnector' {
|
spawn named 'transportConnector' {
|
||||||
at ds {
|
at ds {
|
||||||
during Observe({ "pattern": :pattern G.TransportConnection({
|
during Observe({ "pattern": :pattern G.TransportConnection({
|
||||||
|
@ -470,7 +470,7 @@ export function contactRemote(
|
||||||
controlObject: Ref,
|
controlObject: Ref,
|
||||||
transportAddr: AnyValue,
|
transportAddr: AnyValue,
|
||||||
) => void,
|
) => void,
|
||||||
ds = Dataspace.global,
|
ds = Dataspace.local,
|
||||||
) {
|
) {
|
||||||
const routeValue = 'pathSteps' in route ? G.fromRoute(G.Route(route)) : route;
|
const routeValue = 'pathSteps' in route ? G.fromRoute(G.Route(route)) : route;
|
||||||
at ds {
|
at ds {
|
||||||
|
|
Loading…
Reference in New Issue