feat(startup-data-storage): adapt to the new DI architecture
Bug: twpowertools:226
Change-Id: Id65533f9349cc0945bf46ec016c9973608ba7080
diff --git a/src/services/communityConsole/StartupDataStorage.port.ts b/src/services/communityConsole/StartupDataStorage.port.ts
new file mode 100644
index 0000000..827cd36
--- /dev/null
+++ b/src/services/communityConsole/StartupDataStorage.port.ts
@@ -0,0 +1,22 @@
+import StartupDataModel from "../../models/StartupData";
+
+export interface StartupDataStoragePort {
+ /**
+ * Get the startup data as stored in this class (without having applied any
+ * queued modification).
+ *
+ * NOTE: This might not be synced with the live startup data which exists in the
+ * DOM.
+ */
+ get(): StartupDataModel;
+
+ /* Enqueue a function which includes a modification to the startup data. */
+ enqueueModification(
+ modification: StartupDataModification,
+ ): StartupDataStoragePort;
+
+ /* Apply all the queued modifications and persist the result to the DOM. */
+ applyModifications(): StartupDataStoragePort;
+}
+
+export type StartupDataModification = (startupData: StartupDataModel) => void;