just the bare necessities of state management.
Hotlink it from https://unpkg.com/valoo.
| .rounded-corners-gradient-borders { | |
| width: 300px; | |
| height: 80px; | |
| border: double 4px transparent; | |
| border-radius: 80px; | |
| background-image: linear-gradient(white, white), radial-gradient(circle at top left, #f00,#3020ff); | |
| background-origin: border-box; | |
| background-clip: padding-box, border-box; | |
| } |
| license: mit |
| import { useEffect, useState } from 'react'; | |
| import { StateMachine } from 'xstate'; | |
| import { useMachine } from '@xstate/react'; | |
| import { inspect } from '@xstate/inspect'; | |
| let iFrameElement: HTMLIFrameElement | null = null; | |
| function createIFrame() { | |
| if (!iFrameElement) { | |
| const iframe = document.createElement('iframe'); |
just the bare necessities of state management.
Hotlink it from https://unpkg.com/valoo.
| // array utils | |
| // ================================================================================================= | |
| const combine = (...arrays) => [].concat(...arrays); | |
| const compact = arr => arr.filter(Boolean); | |
| const contains = (() => Array.prototype.includes | |
| ? (arr, value) => arr.includes(value) | |
| : (arr, value) => arr.some(el => el === value) |
| [] + []; // JavaScript will give you "" (which makes little sense), TypeScript will error | |
| // | |
| // other things that are nonsensical in JavaScript | |
| // - don't give a runtime error (making debugging hard) | |
| // - but TypeScript will give a compile time error (making debugging unnecessary) | |
| // | |
| {} + []; // JS : 0, TS Error | |
| [] + {}; // JS : "[object Object]", TS Error | |
| {} + {}; // JS : NaN, TS Error |
| SystemJS.config({ | |
| transpiler: "typescript", | |
| typescriptOptions: { | |
| "experimentalDecorators": true, | |
| "emitDecoratorMetadata": true | |
| }, | |
| map: { | |
| "rxjs": "https://npmcdn.com/rxjs", | |
| "angular2": "https://npmcdn.com/angular2", | |
| "@ngrx": "https://npmcdn.com/@ngrx", |
| <!DOCTYPE html> | |
| <html lang="en"> | |
| <head> | |
| <meta charset="UTF-8"> | |
| <title>RxJSCraft</title> | |
| <script src="https://npmcdn.com/[email protected]/dist/system.js"></script> | |
| <script src="https://npmcdn.com/[email protected]/lib/typescript.js"></script> | |
| </head> |
| <!DOCTYPE html> | |
| <html lang="en"> | |
| <head> | |
| <meta charset="UTF-8"> | |
| <title>RxJSCraft</title> | |
| <script src="https://npmcdn.com/[email protected]/dist/system.js"></script> | |
| <script src="https://npmcdn.com/[email protected]/lib/typescript.js"></script> | |
| <script src="https://npmcdn.com/[email protected]/bundles/Rx.js"></script> | |
| <style> |
| System.config({ | |
| //use typescript for compilation | |
| transpiler: 'typescript', | |
| //typescript compiler options | |
| typescriptOptions: { | |
| emitDecoratorMetadata: true | |
| }, | |
| //map tells the System loader where to look for things | |
| map: { | |
| app: "./src", |