import { ActionType , createAction } from '@ulangi/ulangi-action' ; import { put , take } from 'redux-saga/effects' ; import { SystemThemeAdapter } from '../adapters/SystemThemeAdapter' ; import { PublicSaga } from '../sagas/PublicSaga' ; export class ThemeSaga extends PublicSaga { private systemTheme : SystemThemeAdapter ; public constructor ( systemTheme ) { super ( ) ; this . systemTheme = systemTheme ; } public * run ( ) { const channel = this . systemTheme . createEventChannel ( ) ; while ( true ) { const systemMode = yield take ( channel ) ; yield put ( createAction ( ActionType . THEME__SYSTEM_MODE_CHANGED , { systemMode } ) ) ; } } }