fix(player):export storage selectors
This commit is contained in:
parent
6a82d34d8c
commit
bb8a0105a1
2 changed files with 49 additions and 4 deletions
|
|
@ -1,8 +1,10 @@
|
|||
export * from './web/assist/AssistManager';
|
||||
export * from './web/assist/LocalStream';
|
||||
export * from './web/WebPlayer';
|
||||
export * from './web/types';
|
||||
export * from './common/types';
|
||||
export * from './create';
|
||||
|
||||
|
||||
export * from './web/assist/AssistManager';
|
||||
export * from './web/assist/LocalStream';
|
||||
export * from './web/WebPlayer';
|
||||
export * from './web/storageSelectors';
|
||||
export * from './web/types';
|
||||
export type { MarkedTarget } from './web/TargetMarker'
|
||||
|
|
|
|||
43
frontend/app/player/web/storageSelectors.ts
Normal file
43
frontend/app/player/web/storageSelectors.ts
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
import { State } from './Lists'
|
||||
|
||||
enum StorageType {
|
||||
REDUX = "redux",
|
||||
MOBX = "mobx",
|
||||
VUEX = "vuex",
|
||||
NGRX = "ngrx",
|
||||
ZUSTAND = "zustand",
|
||||
NONE = 0,
|
||||
}
|
||||
|
||||
export const STORAGE_TYPES = StorageType
|
||||
|
||||
export function selectStorageType(state: State): StorageType {
|
||||
if (!state.reduxList) return STORAGE_TYPES.NONE
|
||||
if (state.reduxList.length > 0) {
|
||||
return STORAGE_TYPES.REDUX
|
||||
} else if (state.vuexList.length > 0) {
|
||||
return STORAGE_TYPES.VUEX
|
||||
} else if (state.mobxList.length > 0) {
|
||||
return STORAGE_TYPES.MOBX
|
||||
} else if (state.ngrxList.length > 0) {
|
||||
return STORAGE_TYPES.NGRX
|
||||
} else if (state.zustandList.length > 0) {
|
||||
return STORAGE_TYPES.ZUSTAND
|
||||
}
|
||||
return STORAGE_TYPES.NONE
|
||||
}
|
||||
|
||||
export function selectStorageList(state: State) {
|
||||
const key = selectStorageType(state)
|
||||
if (key !== StorageType.NONE) {
|
||||
return state[`${key}List`]
|
||||
}
|
||||
return []
|
||||
}
|
||||
export function selectStorageListNow(state: State) {
|
||||
const key = selectStorageType(state)
|
||||
if (key !== StorageType.NONE) {
|
||||
return state[`${key}ListNow`]
|
||||
}
|
||||
return []
|
||||
}
|
||||
Loading…
Add table
Reference in a new issue