(All feedback/discussion should take place in the relevant issue.)
There's multiple requests for the ability to control a type at a much more fine grained level:
"use strict" | |
var coreRenderer = require("../render/render") | |
function throttle(callback) { | |
//60fps translates to 16.6ms, round it down since setTimeout requires int | |
var delay = 16, last = 0, pending | |
var timeout = typeof requestAnimationFrame === "function" ? requestAnimationFrame : setTimeout | |
return function() { | |
if (pending == null) { |
(All feedback/discussion should take place in the relevant issue.)
There's multiple requests for the ability to control a type at a much more fine grained level:
Note: if you wish to comment on this proposal, tell me here, so I can actually be notified.
Just an attempt to come up with a sane pattern matching proposal that doesn't hit any of the following pitfalls:
/** | |
* A super simple cancel token utility, with support all the way to ES3. Works | |
* in browsers, AMD, and CommonJS environments. 874 bytes minified and gzipped. | |
* | |
* The API is pretty simple: | |
* | |
* `const source = cancelSource(parentTokens?)` | |
* | |
* - `source.cancel(reason?)` | |
* Trigger a cancel with some reason, and save the cancel result to |
// A simpler implementation of date handling, with the following additional | |
// assumptions: | |
// | |
// 1. We only need the day, month, and year. | |
// 2. Time zones are irrelevant. | |
// 3. Day/month/year checks and range checks are *far* more common than date | |
// difference calculation. | |
// 4. Dates are rarely written to, mostly read. | |
// | |
// Helpfully, this lets us represent dates with a single 32-bit integer, which |
/** | |
* A lazy value that also memoizes exceptions and checks for recursion. | |
*/ | |
export class Lazy { | |
constructor(init) { | |
this.state = State.Init | |
this.value = init | |
} | |
// This shouldn't count against the inline quota. |
// Note: this uses generators exclusively to avoid blowing up your RAM - 10-item | |
// arrays will produce about 11 billion entries. You can use | |
// `repeatedPermutationWithSubsetsCount` with the length to see how many items | |
// will be produced. | |
function *permRep(array, data, index) { | |
if (index === data.length) { | |
yield data.slice() | |
} else { | |
for (let i = 0; i < array.length; i++) { | |
data[index] = array[i] |
import m from "mithril" | |
import { Connect } from "./redux-zero-mithril" | |
import { increment, decrement } from "./actions" | |
const mapToProps = ({ count }) => ({ count }) | |
export default function Counter() { | |
return {view({attrs}) { | |
return m(Connect, {to: attrs.store, with: mapToProps, view({count}) { |
Please direct all comments to this issue. I won't receive notifications if you comment here, but I will receive them if you comment there.
This is an attempt to create a more cohesive, easy-to-implement DSL proposal for JavaScript, attempting to work around most of the issues described in this original proposal. Of course, this is pretty poorly formatted and it's missing a few edge cases, but it's just a strawman.
@@this
context (syntax error outside DSL)@foo(...) do { ... }
- Invoke @@this.foo(..., block)
/** | |
* Copyright (c) 2017 and later, Isiah Meadows. Licensed under the ISC License. | |
*/ | |
// Execute the Test262 test suite with a parser. This checks for parser | |
// conformance correctly, and requires little configuration on your part. | |
// | |
// Options supported, `opts.test262Dir`, `opts.test`, and `opts.parse` are | |
// required: | |
// - `opts.test262Dir` - The directory to a clone of the Test262 suite |