state.ts 783 B

1234567891011121314151617181920212223242526272829303132
  1. import { cloneDeep } from 'lodash'
  2. export interface simulationSetup {
  3. hostIndex: number
  4. fromWL: number; toWL:number; pointsWL:number
  5. }
  6. export interface simulationSetupStateInterface {
  7. library: Map<string,simulationSetup>
  8. gui: simulationSetup
  9. current: simulationSetup
  10. }
  11. function setupFactory(hostIndex = 1,
  12. fromWL = 300, toWL=1000, pointsWL=100
  13. ):simulationSetup {
  14. return {hostIndex:hostIndex,
  15. fromWL:fromWL, toWL:toWL, pointsWL:pointsWL }
  16. }
  17. function state(): simulationSetupStateInterface {
  18. const gui = setupFactory()
  19. const current = cloneDeep(gui)
  20. const library = new Map<string,simulationSetup>()
  21. library.set('default', cloneDeep(gui))
  22. return {
  23. library,
  24. gui,
  25. current
  26. }
  27. };
  28. export default state;