Can we allow JS functions to opt-in to be prempted?
An expensive synchronous function will jank the UI:
function expensive() {}
import lottie from './lib/lottie-import.js'; | |
export class LottiePlayerElement extends HTMLElement { | |
get src(): string | null { | |
return this.getAttribute('src'); | |
} | |
set src(v: string | null) { | |
if (v == null) { |
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"/> | |
<title>Text data vs nodeValue #jsbench #jsperf</title> | |
<script src="https://cdnjs.cloudflare.com/ajax/libs/benchmark/1.0.0/benchmark.min.js"></script> | |
<script src="./suite.js"></script> | |
</head> | |
<body> | |
<h1>Open the console to view the results</h1> |
import {LitElement, html} from 'lit-element'; | |
import {UseWindowSize} from './useWindowSize.js'; | |
class extends UseWindowSize()(LitElement) { | |
render() { | |
return html` | |
<p> | |
width: ${window.innerWidth} | |
height: ${window.innerHeight} | |
</p> |
export const a = 'hello'; | |
export const f = (a: any, b: any, c: any) => { | |
return { | |
a, b, c | |
}; | |
}; |
async function findIndexAsync(promises, predicate) { | |
let i = 0; | |
for await (const p of asyncIterate(promises)) { | |
if (predicate(p)) { | |
return i; | |
} | |
i++; | |
} | |
} |
const NativeHTMLElement = window.HTMLElement; | |
const documentWrite = document.write; | |
const documentOpen = document.open; | |
window.HTMLElement = class extends NativeHTMLElement { | |
constructor(...args) { | |
console.assert(args.length === 0); | |
super(); |
<!doctype html> | |
<html> | |
<head> | |
<script src="shadow-root.js"></script> | |
</head> | |
<div> | |
<div slot="main"> | |
I'm some projected content. | |
</div> | |
<shadow-root> |
{ | |
"font-roboto": "https://raw.githubusercontent.com/PolymerElements/font-roboto/v1.0.1/", | |
"iron-flex-layout": "https://raw.githubusercontent.com/PolymerElements/iron-flex-layout/v1.0.2/", | |
"paper-material": "https://raw.githubusercontent.com/PolymerElements/paper-material/v1.0.1/", | |
"paper-styles": "https://raw.githubusercontent.com/PolymerElements/paper-styles/v1.0.10/", | |
"polymer": "https://raw.githubusercontent.com/Polymer/polymer/v1.0.7/", | |
"webcomponentsjs": "https://raw.githubusercontent.com/webcomponents/webcomponentsjs/v0.7.7/" | |
} |
import 'dart:async'; | |
import 'package:postgresql/postgresql.dart'; | |
void main() { | |
var username = "TheRightMan"; | |
var password = "WithTheRightSecret"; | |
var DBname = "AtTheRightPlace"; | |
var uri = 'postgres://$username:$password@localhost:5432/$DBname'; | |