This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import kotlinx.coroutines.* | |
object Dispatchers { | |
val Main: CoroutineDispatcher get() = kotlinx.coroutines.Dispatchers.Default | |
val IO: CoroutineDispatcher get() = kotlinx.coroutines.Dispatchers.IO | |
val Default: CoroutineDispatcher get() = kotlinx.coroutines.Dispatchers.Default | |
val Unconfined: CoroutineDispatcher get() = kotlinx.coroutines.Dispatchers.Unconfined | |
} | |
class LaunchBlock( |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package ru.test.app.ui.features.profile | |
import androidx.compose.material.Button | |
import androidx.compose.material.Text | |
import androidx.compose.runtime.Composable | |
import androidx.compose.runtime.collectAsState | |
import androidx.compose.runtime.getValue | |
import androidx.compose.ui.platform.LocalLifecycleOwner | |
import androidx.compose.ui.tooling.preview.Preview | |
import androidx.hilt.navigation.compose.hiltViewModel |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Init, LoadableData } from "./LoadableData"; | |
import { LoadableDataEvent } from "./LoadableDataEvent"; | |
export function init<T>(data?: T): Init<T> { | |
return { | |
state: "init", | |
data, | |
}; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
type Supplier<T> = () => T; | |
type Value<T> = T; | |
type SupplierOnValue<T> = Supplier<T> | Value<T>; | |
type Closable = { close(): Promise<void> }; | |
type ClosableCreator<T> = SupplierOnValue<Promise<T>>; | |
type Use = <C extends Closable>(closableCreator: ClosableCreator<C>) => Promise<C>; | |
type Runnable<Result> = (use: Use) => Promise<Result>; | |
type ClosableSync = { close(): void }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { useStore } from 'effector-react' | |
import { useEffect } from 'react'; | |
import { pageMounted, listStore, stateStore } from './TodoList.store'; | |
const TodoList = () => { | |
useEffect(pageMounted, []); | |
const list = useStore(listStore); | |
const state = useStore(stateStore); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { createStore, createEffect } from 'effector'; | |
import { listApi } from '../../api/Todo'; | |
const store = createStore({ | |
list: [], | |
state: 'INIT' | |
}); | |
const loadTodoList = createEffect(listApi); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { createStore, createEffect } from 'effector'; | |
import { listApi } from '../../api/Todo'; | |
const listStore = createStore([]); | |
const stateStore = createStore('INIT'); | |
const loadTodoList = createEffect(() => listApi()); | |
stateStore.on(loadTodoList, () => 'LOADING'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const int2ip = (ipInt) => ( | |
(ipInt >>> 24) + '.' + | |
(ipInt >> 16 & 255) + '.' + | |
(ipInt >> 8 & 255) + '.' + | |
(ipInt & 255) | |
); | |
const ip2int = (ip) => ip.split('.').reduce( | |
(ipInt, octet) => (ipInt << 8) + parseInt(octet, 10), 0 | |
) >>> 0; |
NewerOlder