func-level DCE | func-level DCE(kernel) | rename record/constructor | rename all | unwrap constructor | minify | |
---|---|---|---|---|---|---|
default | ✅ | ❌ | ❌ | ❌ | ❌ | ❌ |
--optimize | ✅ | ❌ | ✅ | ❌ | ✅ | ❌ |
--optimize + uglifyjs | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
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
class SelectListElement extends HTMLElement { | |
constructor() { | |
super(); | |
this.addEventListener("click", e => { | |
let target = e.target as Element; | |
while (target.parentElement !== this) { | |
target = target.parentElement; | |
} | |
if (target instanceof SelectItemElement) { | |
e.stopPropagation(); |
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 MIDIInputMap = Map<DOMString, MIDIInput>; // maplike | |
type MIDIOutputMap = Map<DOMString, MIDIOutput>; // maplike | |
type DOMString = string; | |
interface MIDIAccess extends EventTarget { | |
readonly inputs: MIDIInputMap; | |
readonly outputs: MIDIOutputMap; | |
onstatechange: (e: MIDIConnectionEvent) => void; | |
readonly sysexEnabled: boolean; | |
} |
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
export abstract class DomSync<T, Context extends unknown[]> { | |
constructor( | |
private root: Element | Document | ShadowRoot, | |
private selector?: string | |
) {} | |
abstract readonly class: string; | |
protected identify(obj: T): string | number { | |
const o = obj as any; | |
if (o && (typeof o.id === "string" || typeof o.id === "number")) { | |
return String(o.id).trim(); |
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 BASE_HELTZ = 440; | |
function generateId() { | |
return Math.random() | |
.toString(36) | |
.substr(2, 9); | |
} | |
function noteToHz(note: number) { | |
return BASE_HELTZ * 2 ** ((note - 69) / 12); | |
} |
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 fs = require("fs"); | |
const childProcess = require("child_process"); | |
childProcess.exec("./node_modules/.bin/elm-analyse", (e, out) => { | |
let file; | |
let all = {}; | |
for (let line of out.split("\n")) { | |
if (line.startsWith("-")) { | |
file = line.slice(2); | |
continue; |
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
let count = 0; | |
async function* loop() { | |
while (true) { | |
await new Promise(resolve => setTimeout(resolve, 3000)); | |
yield count++; | |
} | |
} | |
(async () => { | |
for await (const n of loop()) { | |
console.log(n); |
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 alias OriginalFoo = | |
{ barText : Maybe String | |
, mustNum : Int | |
} | |
type alias Foo = | |
{ barText : String | |
, mustNum : Int |
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 fs = require("fs"); | |
const fetch = require("node-fetch"); | |
const readline = require("readline"); | |
run().catch(err => { | |
console.error(err.message); | |
process.exit(1); | |
}); | |
async function run() { |