| category | Components |
|---|---|
| type | Feedback |
| title | Alert |
Alert component for feedback.
| class Slider extends Component{ | |
| renderPlugins(){ | |
| let { children } = this.props; | |
| let dataModel = {...this.props,...this.state}; | |
| return do{ | |
| if(typeof children=='function'){; | |
| children(dataModel) | |
| }else{ | |
| children; | |
| } |
| // 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 => { |
| function memorize(f) { | |
| var cache = {}; | |
| // 这个函数是什么意思呢 | |
| // 就是使用闭包的特性,保留了cache的值 | |
| // 这值将间接使用上次调用时产生的值。下面例子中会详细讲解。 | |
| return function() { | |
| console.log(cache); // 打印缓存值 | |
| // 这里的key就是一个签名档意思,也就是被缓存函数的参数 | |
| var key = Array.prototype.join.call(arguments, ','); | |
| // console.log(key) |
| <html> | |
| <head> | |
| <title>Test</title> | |
| <script src="http://code.jquery.com/jquery-1.9.1.js"></script> | |
| <script src="http://code.jquery.com/ui/1.10.3/jquery-ui.js"></script> | |
| <link rel="stylesheet" href="http://code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css" /> | |
| <script src="http://fb.me/react-0.5.1.js"></script> | |
| <script src="http://fb.me/JSXTransformer-0.5.1.js"></script> | |
| </head> |
Attention: the list was moved to
https://github.com/dypsilon/frontend-dev-bookmarks
This page is not maintained anymore, please update your bookmarks.
| Latency Comparison Numbers (~2012) | |
| ---------------------------------- | |
| L1 cache reference 0.5 ns | |
| Branch mispredict 5 ns | |
| L2 cache reference 7 ns 14x L1 cache | |
| Mutex lock/unlock 25 ns | |
| Main memory reference 100 ns 20x L2 cache, 200x L1 cache | |
| Compress 1K bytes with Zippy 3,000 ns 3 us | |
| Send 1K bytes over 1 Gbps network 10,000 ns 10 us | |
| Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD |