https://zhongsp.gitbooks.io/typescript-handbook/ https://hackmd.io/s/rkITEOYX
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 createKeyEventObserver = () => { | |
const PRESS_THRESHOULD_MS = 500 | |
const LONG_PRESS_TIME_MS = 1500 | |
const keyDowns = fromEvent(document.body, 'keydown') | |
const keyUps = fromEvent(document.body, 'keyup') | |
const source = keyDowns | |
.pipe( | |
merge(keyUps), |
st=>start: Start:>http://www.google.com[blank]
e=>end:>http://www.google.com
op1=>operation: My Operation
sub1=>subroutine: My Subroutine
cond=>condition: Yes
or No?:>http://www.google.com
io=>inputoutput: catch something...
para=>parallel: parallel tasks
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
0x277E034c59dDD2c56539459B0C566075685a681f |
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
// getComponent is a function that returns a promise for a component | |
// It will not be called until the first mount | |
function asyncComponent(getComponent) { | |
return class AsyncComponent extends React.Component { | |
static Component = null; | |
state = { Component: AsyncComponent.Component }; | |
componentWillMount() { | |
if (!this.state.Component) { | |
getComponent().then(Component => { |
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 tree = { | |
name: 'root', | |
children: [ | |
{ | |
name: 'a', | |
children: [ | |
{ name: 'd' }, | |
{ name: '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
Show hidden characters
{ | |
"in_process_packages": | |
[ | |
], | |
"installed_packages": | |
[ | |
"All Autocomplete", | |
"AutoFileName", | |
"Autoprefixer", | |
"Babel", |
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 promiseWhile(condition, body) { | |
var dfd = $.Deferred(); | |
function loop() { | |
if (!condition()) return dfd.resolve(); | |
body.apply(this, arguments) | |
.done(loop) | |
.fail(dfd.reject); | |
} | |
//call loop async |
NewerOlder