index |
---|
This is the FAQ’s README and is not part of the generated book because we configured the book.json
to use home.doc
instead.
// This is some pseudocode | |
function onArchiveAndNext(threadId) { | |
dispatch(archiveThread(threadId)); | |
dispatch(sortingGoToNext(thread)); | |
// We can define the undo logic right next to the effect to undo. | |
// This also means any part of the UI can define its own undoable effect. |
// Converts an old rule definition to an individual plugin with a "validateNode" function | |
// | |
// rule: { | |
// match, | |
// validate, | |
// normalize | |
// } | |
// | |
// returns { | |
// validateNode |
/* @flow */ | |
import { Set } from 'immutable'; | |
/* | |
* Hover state manager for multiple elements. | |
* | |
* Usage: | |
* | |
* onHoverChange callback is called whenever the mouse enter the group |
/** | |
* Converts a {key, offset} combination to a single offset relative to | |
* `node`. `key` must be the key of one of the texts inside `node`. | |
*/ | |
function relativeOffset(node, key, offset) { | |
return node | |
.getTexts() | |
.takeUntil(text => text.key === key) | |
.reduce((absOffset, text) => absOffset + text.length) | |
+ offset; |
Benchmarks | |
delete-backward-deep | |
Current: 229 ops/sec (102 runs sampled) | |
Reference: 234 ops/sec (103 runs sampled) | |
comparison: Indeterminate | |
diff: -2.21% | |
rme: ±3.62% | |
delete-backward-normal |
index |
---|
This is the FAQ’s README and is not part of the generated book because we configured the book.json
to use home.doc
instead.
<!DOCTYPE html> | |
<html> | |
<head> | |
<!-- Immutable --> | |
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/immutable/3.8.1/immutable.js"></script> | |
<!-- React --> | |
<script src="https://cdnjs.cloudflare.com/ajax/libs/react/15.0.1/react.js"></script> | |
<!-- ReactDOM --> | |
<script src="https://cdnjs.cloudflare.com/ajax/libs/react/15.0.1/react-dom.js"></script> | |
<!-- Draft --> |
// Returns a function that can't be called more than once per `delay`, | |
// with a maximum delay of `maxDelay`. The returned function can be called | |
// forcefully through its `flush` property | |
function debounce(fn, delay, maxDelay) { | |
var timer; | |
var maxTimer; | |
var args; | |
var clearTimers = function () { | |
if (timer) clearTimeout(timer); |
{% if site.disqus_short_name and page.comments != false %} | |
<div id="disqus_thread"></div> | |
<script> | |
var disqus_shortname = '{{ site.disqus_short_name }}'; | |
var disqus_config = function () { | |
// _config.yml should define the site's URL | |
this.page.url = '{{ site.url }}{{ page.url }}'; | |
// Using an optional disqus_identifier variable, or the site.url + page.id combination | |
this.page.identifier = '{% if page.disqus_identifier %}{{ page.disqus_identifier}}{% else %}{{ site.url }}{{ page.id }}{% endif %}'; | |
}; |