100
101
---
100
100
101
---
101
| // per https://twitter.com/yoshuawuyts/status/1494119486429007879 | |
| // "In JavaScript, is there a function which takes N Promises, and returns an asyncIterator which yields N resolved values?" | |
| let promises = Array.from({length: 10}, (n, i) => { | |
| return new Promise(cb => setTimeout(cb, Math.random() * 1e3, i)) | |
| }) | |
| let iterator = iteratePromises(promises) | |
| for await (let value of iterator) console.log(value) |
| // @ts-nocheck TODO: remove at some point | |
| import babel from 'rollup-plugin-babel'; | |
| import commonjs from 'rollup-plugin-commonjs'; | |
| import config from 'sapper/config/rollup.js'; | |
| import getPreprocessor from 'svelte-preprocess' | |
| import path from 'path' | |
| import pkg from './package.json'; | |
| import postcss from 'rollup-plugin-postcss' | |
| import replace from 'rollup-plugin-replace'; |
| // Web-Push | |
| // Public base64 to Uint | |
| function urlBase64ToUint8Array(base64String) { | |
| var padding = '='.repeat((4 - base64String.length % 4) % 4); | |
| var base64 = (base64String + padding) | |
| .replace(/\-/g, '+') | |
| .replace(/_/g, '/'); | |
| var rawData = window.atob(base64); | |
| var outputArray = new Uint8Array(rawData.length); |
This focuses on generating the certificates for loading local virtual hosts hosted on your computer, for development only.
Do not use self-signed certificates in production ! For online certificates, use Let's Encrypt instead (tutorial).
All libraries have subtle rules that you have to follow for them to work well. Often these are implied and undocumented rules that you have to learn as you go. This is an attempt to document the rules of React renders. Ideally a type system could enforce it.
A number of methods in React are assumed to be "pure".
On classes that's the constructor, getDerivedStateFromProps, shouldComponentUpdate and render.
| { | |
| "version": "0.2.0", | |
| "configurations": [ | |
| { | |
| "name": "Example", | |
| "type": "node", | |
| "request": "launch", | |
| "runtimeExecutable": "node", | |
| "runtimeArgs": ["--nolazy", "-r", "ts-node/register/transpile-only"], |
// default exports
export default 42;
export default {};
export default [];
export default (1 + 2);
export default foo;
export default function () {}
export default class {}
export default function foo () {}