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
import { EventDispatcher } from "three"; | |
export default class Loop extends EventDispatcher { | |
constructor(fps = 60, speed = 1) { | |
super(); | |
this._timeStep = (1000 / fps) * speed; | |
this._prevTime = null; | |
this._lagTime = 0; |
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
import React, { Component } from 'react'; | |
class State { | |
constructor() { | |
this.state = {}; | |
this.subscriptions = []; | |
} | |
subscribe(cb) { | |
this.subscriptions.push(cb); |
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 I = 'data-id' | |
let s = 'string' | |
let n = 'number' | |
let d = document | |
let O = Object | |
let a = (el, x) => | |
x.reduce((e, c) => { | |
e.appendChild(c instanceof HTMLElement ? c : d.createTextNode(c)) | |
return e |
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 $ = q => (els => els.length > 1 ? els : els[0])(document.querySelectorAll(q)) |
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
{ | |
"name": "rollup-kitchensink", | |
"version": "0.0.0", | |
"description": "Kitchensink of rollup plugins", | |
"author": "Ezekiel Chentnik", | |
"license": "MIT", | |
"scripts": { | |
"test": "echo write tests yo" | |
}, | |
"dependencies": { |
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 class Static extends React.Component { | |
shouldComponentUpdate() { | |
return false; | |
} | |
render() { | |
var child = this.props.children; | |
if (child === null || child === false) { | |
return null; |
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
function mainView (state, emit) { | |
return html` | |
<body> | |
<h1>count is ${state.count}</h1> | |
<button onclick=${onclick}>Increment</button> | |
</body> | |
` | |
function onclick () { | |
emit('increment', 1) |
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 microtask = () => { | |
let node = document.createTextNode(''), | |
queue = [], | |
i = 0 | |
new window.MutationObserver(() => { | |
while (queue.length) queue.shift()() | |
}).observe(node, { characterData: true }) | |
return fn => { |
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
function nanotask (cb) { | |
Promise.resolve().then(cb) | |
} |
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
var createView = function(update) { | |
var increase = function(amount) { | |
return function(_event) { | |
update(amount); | |
}; | |
}; | |
var view = function(model) { | |
return (<div> | |
<div>Counter: {model}</div> |