This file contains hidden or 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
| public function isBrowser() | |
| { | |
| $arguments = func_get_args(); | |
| return $this->browserDetector->isBrowser(...$arguments); | |
| } |
This file contains hidden or 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
| /** | |
| * State | |
| * | |
| * Для начала определим интерфейс этого кусочка хранилища, | |
| * и создадим объект с начальным состоянием. | |
| */ | |
| export interface FieldState { | |
| value: string; | |
| focus: boolean; | |
| } |
This file contains hidden or 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
| /** | |
| * Класс для сбора и отложенного выполнения команд. | |
| * | |
| * Кейс для использования - класс с динамическим импортом модуля, | |
| * методы которого должны сработать после успешной загрузки этого модуля. | |
| */ | |
| export class CommandExecutor { | |
| private ready = false; | |
| private commands: Map<string, any[]> = new Map(); |
This file contains hidden or 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
| // Обработка opaque response https://stackoverflow.com/questions/39109789/what-limitations-apply-to-opaque-responses | |
| // По умолчанию, ответы без Content-Length резервируют очень много пространства в хранилище браузера | |
| const OpaqueResponsePlugin = { | |
| // Меняем mode и credentials у запроса | |
| requestWillFetch: async ({request}) => { | |
| if (request.mode === 'cors' && request.credentials === 'same-origin') { | |
| return request; | |
| } |
This file contains hidden or 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 path = require('path'); | |
| const webpack = require('webpack'); | |
| const vendor = [ | |
| { library: 'jquery', globals: ['jQuery', '$'] }, | |
| { library: 'react', globals: ['React'] }, | |
| { library: 'react-dom', globals: ['ReactDOM'] } | |
| ]; | |
| const createExposeLoader = (config) => { |
This file contains hidden or 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 { Store, Unsubscribe } from 'redux'; | |
| const defaultEqual = <P>(prev: P, next: P) => prev === next; | |
| const defaultImmediately = true; | |
| interface IWatcherParams<S, V, P> { | |
| store: Store<S>; | |
| selector: (state: S, params?: P) => V; | |
| onChange: (prev: V, next: V) => void; | |
| props?: P; |
This file contains hidden or 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 source = { | |
| * name: 'Test', | |
| * last_name: 'Test', | |
| * phone: '123456789' | |
| * }; | |
| * | |
| * const dist = { |
This file contains hidden or 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
| export enum constants { | |
| FETCH_REQUEST = 'module/FETCH_REQUEST', | |
| FETCH_SUCCESS = 'module/FETCH_SUCCESS', | |
| FETCH_FAILURE = 'module/FETCH_FAILURE' | |
| } | |
| interface IState { | |
| isFetching: Readonly<boolean>; | |
| isError: Readonly<boolean>; | |
| data: Readonly<IApiResponse>; |
This file contains hidden or 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 emptyCounterparties = []; | |
| const emptyProducts = []; | |
| /** Список банков */ | |
| export const getCounterparties = (state) => state.orders.data.counterparties; | |
| /** Конкретный банк */ | |
| export const getCounterparty = (state, props) => | |
| state.orders.data.counterparties[props.bankId] || null; |
This file contains hidden or 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
| export const constants = { | |
| FETCH_REQUEST: 'FETCH_REQUEST', | |
| FETCH_SUCCESS: 'FETCH_SUCCESS', | |
| FETCH_FAILURE: 'FETCH_FAILURE' | |
| } | |
| const initialState = { | |
| isFetching: false, | |
| error: false, | |
| data: null |