reveal.js code example
Example 1: what is reveal.js plugin
ES6 Generator
may be paused in the middle, one or many times, and resumed later,
allowing other code to run during these paused periods.
If you've ever read anything about concurrency or threaded programming,
"cooperative", which basically indicates that a process (in our case, a function) itself
chooses when it will allow an interruption, so that it can cooperate with other code.
This concept is contrasted with "preemptive",
which suggests that a process/function could be interrupted against its will.
ES6 generator functions are "cooperative" in their concurrency behavior.
Inside the generator function body, you use the new yield keyword to pause the function from inside itself.
Nothing can pause a generator from the outside; it pauses itself when it comes across a yield.
However, once a generator has yield-paused itself,
it cannot resume on its own.
An external control must be used to restart the generator.
Example 2: what is reveal.js plugin
export default () => {
id: 'toaster',
init: ( deck ) => {
deck.addKeyBinding( { keyCode: 84, key: 'T' }, () => {
deck.shuffle();
console.log('beer');
} );
}
}