Skip to content

Instantly share code, notes, and snippets.

@falsandtru
falsandtru / example.ts
Last active April 19, 2019 02:04
Example.
import { Shadow, HTML, El } from 'typed-dom';
class Component implements El {
private readonly dom = Shadow.section({
style: HTML.style(`ul { width: 100px; }`),
content: HTML.ul([
HTML.li(`item`),
]),
});
public readonly element = this.dom.element;
@falsandtru
falsandtru / ExIterable.ts
Created March 3, 2016 18:39 — forked from tetsuharuohzeki/ExIterable.ts
Extentions for ECMA262 6th iterator
class ExIterable<T> implements Iterable<T> {
protected _source: Iterable<any>; // cheat to drop type param `R`.
protected _operator: Operator<any, T>; // cheat to drop type param `R`.
constructor(source: Iterable<T> = null) {
this._source = source;
this._operator = null;
}
@falsandtru
falsandtru / typescript-isomorphic-amd-node-module-header.js
Last active February 20, 2016 00:50
TypeScript bundled file header for an isomorphic single file node module.
// # TypeScript compilation and bundling
// $ tsc -t es5 -m amd --moduleResolution node --outFile bundle.js mylib.ts src/a.ts src/b.ts
// ^~~~~~ ^~~~~~~~~~~~~~~~~~~~~~~ ^~~~~~~~~~~~~~~~~~~
// # terminal
// $ node
// > require('./bundle.js')
// 1 2
// { default: 3 }
//
// # browser console