-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.tsx
30 lines (25 loc) · 992 Bytes
/
index.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
import './fonts.css'
import './framework/styles.css'
import Assembly from './framework/assembly'
import { Storage } from './framework/types/modules'
import LiveStorage from './live_storage'
import FakeStorage from './fake_storage'
const rootElement = document.getElementById('root') as HTMLElement
const locale = 'en'
const workerFile = new URL('./framework/processing/py_worker.js', import.meta.url)
const worker = new Worker(workerFile)
let assembly: Assembly
const run = (system: Storage): void => {
assembly = new Assembly(worker, system)
assembly.visualisationEngine.start(rootElement, locale)
assembly.processingEngine.start()
}
if (process.env.REACT_APP_BUILD !== 'standalone' && process.env.NODE_ENV === 'production') {
// Setup embedded mode (requires to be embedded in iFrame)
console.log('Initializing storage system')
LiveStorage.create(window, run)
} else {
// Setup local development mode
console.log('Running with fake storage')
run(new FakeStorage())
}