Автор: dSalieri
Версия ECMAScript, используемая в объяснении: Draft ECMA-262 / June 24, 2022
Версия WHATWG, используемая в объяснении: Living Standard - 22 August 2022
Последнее изменение документа: 13.12.2022
Автор: dSalieri
Версия ECMAScript, используемая в объяснении: Draft ECMA-262 / June 24, 2022
Версия WHATWG, используемая в объяснении: Living Standard - 22 August 2022
Последнее изменение документа: 13.12.2022
| type ValueOf<T> = T[keyof T]; | |
| type ArrayPath<T> = | |
| T extends Array<unknown> | |
| ? ArrayPath<Omit<T, keyof []>> | |
| : T extends object | |
| ? ValueOf<{ | |
| [K in keyof T]: [K] | [K, ...ArrayPath<T[K]>]; | |
| }> | |
| : never; |
https://effector.now.sh/en/api/effector/restore
Используется тогда, когда необходимо из ивента напрямую выставить значение в стор в обход .on.
Аналог без restore:
const $store = createStore('');
const event = createEvent();
$store.on(event, (_, payload) => payload);| const TIMEOUT = 500 | |
| patterns = { | |
| 's-r': [83, 82] | |
| } | |
| handler = e => { | |
| // console.log(e.which) | |
| clearTimeout(handler.timer) | |
| handler.keys[e.which] = true |
| // A simple counter example | |
| // The setup will be more complicated in modern apps built using React | |
| const incrementNode = document.getElementById('increment'); | |
| const decrementNode = document.getElementById('decrement'); | |
| const inputNode = document.getElementById('counter'); | |
| const counter = { | |
| initialize() { | |
| incrementNode.addEventListener('click', (event) => { |
| 100+ different js counter apps... |
| |
| const I = x => x | |
| const K = x => y => x | |
| const A = f => x => f (x) | |
| const T = x => f => f (x) | |
| const W = f => x => f (x) (x) | |
| const C = f => y => x => f (x) (y) | |
| const B = f => g => x => f (g (x)) | |
| const S = f => g => x => f (x) (g (x)) | |
| const S_ = f => g => x => f (g (x)) (x) | |
| const S2 = f => g => h => x => f (g (x)) (h (x)) |
| /*eslint-env es6 */ | |
| // Inspired by the paper "A tutorial on the universality and | |
| // expressiveness of fold" by Graham Hutton (available at | |
| // http://www.cs.nott.ac.uk/~gmh/fold.pdf), implementing some generic | |
| // list handling functions in JavaScript in terms of `fold`. | |
| // Personally I had an enlightnening moment when I realised the | |
| // beautiful interplay of cons lists and foldr during the FP101x | |
| // Haskell course. JavaScript's syntax doesn't make this very apparent |