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
| type BaseEventsMap = { | |
| [key: string]: any[]; // ключ - название события, значение - возможные аргументы | |
| }; | |
| type Callback<P extends any[]> = (...payload: P) => void; | |
| class EventEmitter<EventsMap extends BaseEventsMap> { | |
| events: Map<keyof EventsMap, Set<Callback<EventsMap[keyof EventsMap]>>> = new Map(); | |
| on<E extends keyof EventsMap>(event: E, callback: Callback<EventsMap[E]>): Function { |
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
| enum ServicesNames { | |
| WorldService = 'WorldService', | |
| Window = 'WindowService', | |
| DateService = 'DateService', | |
| } | |
| type IServicesList = { | |
| [ServicesNames.WorldService]?: WorldService; | |
| [ServicesNames.Window]?: WindowService; | |
| [ServicesNames.DateService]?: DateService; |
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 { IContent } from '../../common/mapi/entities/content/Content.h'; | |
| import { IPurchaseOptions } from '../../common/mapi/entities/billing/purchaseOptions/PurchaseOptions.h'; | |
| import { IVideoWatchTime } from '../../common/mapi/entities/content/WatchTime.h'; | |
| import { | |
| getObjectMinPurchaseOption, | |
| getObjectPurchases, | |
| getPurchaseFinishTime, | |
| getPurchaseOptionCurrencySymbol, | |
| getPurchaseOptionDiscountDescription, | |
| getPurchaseOptionPrice, |
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 * as React from 'react'; | |
| const HeaderBar: any = () => null; | |
| const BreadCrumbs: any = () => null; | |
| const PageSection: any = () => null; | |
| const MainContent: any = () => null; | |
| const TopInfo: any = () => null; | |
| const AgeBadge: any = () => null; | |
| const Title: any = () => null; | |
| const Parameters: any = () => 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
| const state = [{ | |
| id: 1, | |
| active: false, | |
| loaded: false, | |
| }, { | |
| id: 2, | |
| active: false, | |
| loaded: false, | |
| }, { | |
| id: 3, |
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
| // entities/video/index.ts | |
| type IVideo = { | |
| src: string; | |
| } | |
| const getVideoSrc = (video: IVideo): number => { | |
| return video.src; | |
| } | |
| const setVideoSrc = (video: IVideo, src: string): number => { |
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
| Цикл API + Store + UI: | |
| 1) Модели в API | |
| API/EntityFoo { | |
| id, | |
| bars: [ API/EntityBar ], | |
| bazs: [ API/EntityBaz ], | |
| …otherProps | |
| } |
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 logger = require('../services/logger'); | |
| const needModifyResponse = (req, res) => { | |
| return res.get('content-type') === 'application/json' && !req.path.includes('ajax'); | |
| }; | |
| /** | |
| * Промежуточный обработчик запросов для модификации ответа от сервера | |
| */ | |
| const resJsonToHtmlMiddleware = (req, res, next) => { |
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
| <body | |
| data-rocket-page | |
| data-rocket-info="{ | |
| 'properties': { | |
| 'ui_type': 'content_page', | |
| 'ui_id': 'card', | |
| 'ui_title': 'Мстители: Война бесконечности', | |
| 'content_id': 123456 | |
| }, | |
| 'details': [{ |
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
| enum States { | |
| Empty = 'empty', | |
| Liked = 'liked', | |
| Disliked = 'disliked' | |
| } | |
| enum Actions { | |
| Like = 'LIKE_ACTION', | |
| Dislike = 'DISLIKE_ACTION' | |
| } |