Пусть у нас есть такой объект:
const RADIO_CARD_GROUP_THEME = {
VERTICAL: 'vertical',
HORIZONTAL: 'horizontal',
}| const express = require('express'); | |
| const path = require('path'); | |
| const app = express() | |
| const PORT = process.env.port || 4000 | |
| app.use((req, res, next) => { | |
| res.setHeader('referrer-policy', 'strict-origin-when-cross-origin'); | |
| next(); |
Declare ymaps property with TypeScript through typings.d.ts file (in the /src folder):
export declare global {
interface Window {
ymaps: {
ready: Function,
};
}
}Пример, нужно дернуть какую-то стороннюю апиху https://my-awesome-api.haha CORS настроен таким образом что ты не можешь это сделать со стороннего домена, а доступа к серверу апихи нет (сторонеее апи же). То можно использовать прокси-сервер для этого. CORS реализованы в браузере только.
npx local-cors-proxy --proxyUrl https://my-awesome-api.hahaЭто тулза выдаст примерно следующее:
| const loadIconAndConvertIconToBase64 = url => { | |
| return fetch(url) | |
| .then(response => response.blob()) | |
| .then(blob => new Promise((resolve, reject) => { | |
| const reader = new FileReader() | |
| reader.onloadend = () => resolve(reader.result) | |
| reader.onerror = reject | |
| reader.readAsDataURL(blob) | |
| })); | |
| } |
| const firebase = require('firebase'); | |
| require('firebase/firestore'); | |
| // firebase DB | |
| const firebaseConfig = { | |
| apiKey: '', | |
| authDomain: '', | |
| projectId: "", | |
| storageBucket: "", | |
| messagingSenderId: "", |
arr - array of objects
id - filter value
arr.filter((item, index, arr) => arr.findIndex(_item => _item.id === item.id) === index)du -shc * | sort -h - показывает сколько места занимает каждая директорияchrome://version/ (inside Chrome browser) and find "Executable Path" variable ("/Applications/Google Chrome.app/Contents/MacOS/Google Chrome" in my case)const browser = await puppeteer.launch({
executablePath: '/Applications/Google Chrome.app/Contents/MacOS/Google Chrome',
args: ['--disable-blink-features=AutomationControlled'],
headless: false,Add line "browserslist": ["since 2017-06"] to your package.json file. Babel won't add polyfills for async/await, es6.
So you don't need to install and add reneneratorRuntime (or babel-polyfill) to your bundle!