diff options
author | Michael Foiani <sotech117@michaels-mbp-3.devices.brown.edu> | 2022-04-28 16:46:52 -0400 |
---|---|---|
committer | Michael Foiani <sotech117@michaels-mbp-3.devices.brown.edu> | 2022-04-28 16:46:52 -0400 |
commit | 31ca80bf84b811aa6bdd39fe8bb16df8a0bb2944 (patch) | |
tree | f80f69aa35c834761345b346effc36db356d67c4 /src | |
parent | c21c424267711f9534944b749e9e4703dd3c4bd6 (diff) |
Add static instance
Diffstat (limited to 'src')
-rw-r--r-- | src/client/apis/recording/recordingApi.ts | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/src/client/apis/recording/recordingApi.ts b/src/client/apis/recording/recordingApi.ts index bdeeb79ea..9ad7b5165 100644 --- a/src/client/apis/recording/recordingApi.ts +++ b/src/client/apis/recording/recordingApi.ts @@ -1,6 +1,6 @@ import { CollectionFreeFormView } from "../../views/collections/collectionFreeForm"; import React, { useState } from "react"; -import { observable } from "mobx"; +import { observable, observe } from "mobx"; type Movement = { time: number, @@ -28,7 +28,14 @@ export class RecordingApi { private absoluteStart: number; + // create static instance and getter for global use + @observable static _instance: RecordingApi; + public static get instance(): RecordingApi { return RecordingApi._instance } constructor() { + // init the global instance + RecordingApi._instance = this; + + // init the instance variables this.currentPresentation = RecordingApi.NULL_PRESENTATION this.isRecording = false; this.absoluteStart = -1; @@ -53,10 +60,8 @@ export class RecordingApi { // (2) assign meta content if it exists this.currentPresentation.meta = meta || {} - // (3) assign start date to currentPresenation this.currentPresentation.startDate = startDate - // (4) set isRecording true to allow trackMovements this.isRecording = true } @@ -146,4 +151,13 @@ export class RecordingApi { }) } + // observer that can be updated to track the relevant FreeFormView + // public setFreeFormView = (view: CollectionFreeFormView): void => { + // observe(view, 'Document', (change) => { + // if (change.name === '_panX') { + // this.trackMovements(view.Document._panX, view.Document._panY) + // } + // } + // } + }
\ No newline at end of file |