mirror of
https://github.com/litruv/picoGraph.git
synced 2026-07-24 02:36:04 +10:00
Add initial Pico-8 cartridges for testing
- Created test_cart.p8 with basic drawing functionality and a print statement. - Created test_unix.p8 with a simple initialization function.
This commit is contained in:
@@ -54,28 +54,48 @@ export class WorkspacePersistenceManager {
|
||||
}
|
||||
|
||||
this.cancelScheduledPersist();
|
||||
this.#workspace.handlePersistenceStateChange?.({
|
||||
status: "pending",
|
||||
source: "auto",
|
||||
});
|
||||
this.#timerId = window.setTimeout(() => {
|
||||
this.#timerId = null;
|
||||
this.persistImmediately();
|
||||
this.persistImmediately("auto");
|
||||
}, 200);
|
||||
}
|
||||
|
||||
/**
|
||||
* Serializes current workspace state and writes it to localStorage immediately.
|
||||
*
|
||||
* @param {'manual'|'auto'} [source]
|
||||
*/
|
||||
persistImmediately() {
|
||||
persistImmediately(source = "manual") {
|
||||
if (!this.#storageAvailable || typeof window === "undefined") {
|
||||
return;
|
||||
}
|
||||
|
||||
this.cancelScheduledPersist();
|
||||
this.#workspace.handlePersistenceStateChange?.({
|
||||
status: "saving",
|
||||
source,
|
||||
});
|
||||
|
||||
try {
|
||||
const payload = this.serializeWorkspace();
|
||||
window.localStorage.setItem(
|
||||
WORKSPACE_STORAGE_KEY,
|
||||
JSON.stringify(payload)
|
||||
);
|
||||
this.#workspace.handlePersistenceStateChange?.({
|
||||
status: "saved",
|
||||
source,
|
||||
});
|
||||
} catch (error) {
|
||||
console.error("Failed to persist workspace state", error);
|
||||
this.#workspace.handlePersistenceStateChange?.({
|
||||
status: "error",
|
||||
source,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -90,7 +110,7 @@ export class WorkspacePersistenceManager {
|
||||
.filter((entry) => Boolean(entry))
|
||||
.map((entry) => {
|
||||
const variable =
|
||||
/** @type {{ id: string, name: string, type: 'any'|'number'|'string'|'boolean'|'table', defaultValue: import('../BlueprintWorkspace.js').VariableDefaultValue }} */ (
|
||||
/** @type {{ id: string, name: string, type: 'any'|'number'|'string'|'boolean'|'table'|'color', defaultValue: import('../BlueprintWorkspace.js').VariableDefaultValue }} */ (
|
||||
entry
|
||||
);
|
||||
return {
|
||||
|
||||
Reference in New Issue
Block a user