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
поясню: | |
1) Сначала выделяем все что используется более 3х раз в common асинхронный. | |
2) Из остатков экстрактим node_modules из всех дочерних чанков | |
3) Все пихаем в entry chunk | |
new webpack.optimize.CommonsChunkPlugin({ | |
name: 'app', | |
async: 'common', |
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
Углифай без транспиляции для современных браузеров | |
<script type="module" src="bandle.js"> | |
С транспиляцией и прочим | |
<script nomodule src="fallback.js"></script> |
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
// На входе массив | |
var arr = [ | |
{name: 'width', value: 10}, | |
{name: 'height', value: 20} | |
]; | |
// На выходе объект {width: 10, height: 20} | |
const obj = arr.reduce((acc, {name, value}) => acc[name] = value,{}) | |
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 { useEffect, useRef, useCallback } from 'react'; | |
import { createEvent, createStore } from 'effector'; | |
import { useStore } from 'effector-react'; | |
const open = createEvent('open'); | |
const closed = createEvent('closed'); | |
const error = createEvent('error'); | |
const wsStatus = createStore('closed') |
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 {useLocalize, addTranslate} from './useLocalize' | |
addTranslate({ | |
lang: 'ru', | |
translates: { | |
greeting: 'Добро пожаловать, снова' | |
} | |
}); | |
export function App() { |
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 { createEffect, createEvent, createStore, merge } from 'effector'; | |
import nanoid from 'nanoid'; | |
import { request, parseObject } from 'jsonrpc-lite'; | |
const wsURL = `ws://localhost:${process.env.WS_PORT}`; | |
let socket; | |
const awaitingMap = new Map(); | |
function cleanSocket() { |
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 { ky } from './ky.config'; | |
const employeesUrl = 'employees'; | |
export async function fetchEmployees() { | |
return ky.get(employeesUrl).json(); | |
} |
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 { | |
createEffect, | |
createEvent, | |
createStore, | |
sample, | |
merge, | |
guard, | |
forward | |
} from 'effector'; |
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 { createEvent, createStore, forward, guard, sample } from 'effector'; | |
import nanoid from 'nanoid'; | |
export const show = createEvent('show Notify'); | |
export const hide = createEvent('hide Notify'); | |
/** | |
* @type {Event<{variant: string, message: string}>} | |
* @property {string} variant info | success | warning | error | |
*/ |
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 { createEvent, createStore, combine, sample, forward } from 'effector'; | |
import { accessTypes } from 'constants/access-type'; | |
/** | |
* | |
* @type {Event<{title, content, contentText, cb}>} | |
*/ | |
export const openPopover = createEvent('open Popover'); | |
export const closePopover = createEvent('close Popover'); |
OlderNewer