- https://developer.mozilla.org/en-US/docs/Web/API/Web_Speech_API
- https://developer.mozilla.org/en-US/docs/Web/API/SpeechSynthesis
- https://developer.mozilla.org/en-US/docs/Web/API/SpeechRecognition
- https://developer.mozilla.org/en-US/docs/Web/API/SpeechGrammar
- https://www.w3.org/TR/jsgf/
- https://w3c.github.io/speech-api/speechapi.html
import express from 'express'; | |
import cors from 'cors'; | |
import React from 'react'; | |
import { Helmet } from 'react-helmet'; | |
import { renderToString } from 'react-dom/server'; | |
import { matchPath, StaticRouter } from 'react-router-dom'; | |
import App from '../shared/App'; | |
import routes from '../shared/routes'; |
// Файл "tsconfig.json": | |
// - устанавливает корневой каталог проекта TypeScript; | |
// - выполняет настройку параметров компиляции; | |
// - устанавливает файлы проекта. | |
// Присутствие файла "tsconfig.json" в папке указывает TypeScript, что это корневая папка проекта. | |
// Внутри "tsconfig.json" указываются настройки компилятора TypeScript и корневые файлы проекта. | |
// Программа компилятора "tsc" ищет файл "tsconfig.json" сначала в папке, где она расположена, затем поднимается выше и ищет в родительских папках согласно их вложенности друг в друга. | |
// Команда "tsc --project C:\path\to\my\project\folder" берет файл "tsconfig.json" из папки, расположенной по данному пути. | |
// Файл "tsconfig.json" может быть полностью пустым, тогда компилятор скомпилирует все файлы с настройками заданными по умолчанию. | |
// Опции компилятора, перечисленные в командной строке перезаписывают собой опции, заданные в файле "tsconfig.json". |
if ('NodeList' in window && !NodeList.prototype.forEach) { | |
console.info('polyfill for IE11'); | |
NodeList.prototype.forEach = function (callback, thisArg) { | |
thisArg = thisArg || window; | |
for (var i = 0; i < this.length; i++) { | |
callback.call(thisArg, this[i], i, this); | |
} | |
}; | |
} |
Рассмотрим перебор массива с коллбэком: | |
const BEATLES = ['john', 'paul', 'george', 'ringo']; | |
// Обычный цикл for: | |
for (let i = 0; i < BEATLES.length; ++i) { | |
console.log(BEATLES[i]); | |
} | |
// Метод Array.forEach: | |
BEATLES.forEach(beatle => console.log(beatle)); |
import React from 'react'; | |
import axios from 'axios'; | |
// This is a Higher Order Component that abstracts duplicated data fetching | |
// on the server and client. | |
export default function SSR(Page) { | |
class SSR extends React.Component { | |
static getInitialData(ctx) { | |
// Need to call the wrapped components getInitialData if it exists | |
return Page.getInitialData |
This is a working example on how to store CryptoKey
s locally in your browser. We are able to save the objects, without serializing them. This means we can keep them not exportable (which might be more secure?? not sure what attack vectors this prevents).
To try out this example, first make sure you are in a browser that has support for async...await
and indexedDB (latest chrome canary with chrome://flags
"Enable Experimental Javascript" works). Load some page and copy and paste this code into the console. Then call encryptDataSaveKey()
. This will create a private/public key pair and encrypted some random data with the private key. Then save both of them. Now reload the page, copy in the code, and run loadKeyDecryptData()
. It will load the keys and encrypted data and decrypt it. You should see the same data logged both times.
function getUrlParams(search) { | |
const hashes = search.slice(search.indexOf('?') + 1).split('&') | |
const params = {} | |
hashes.map(hash => { | |
const [key, val] = hash.split('=') | |
params[key] = decodeURIComponent(val) | |
}) | |
return params | |
} |