diff options
Diffstat (limited to 'README.md')
-rw-r--r-- | README.md | 27 |
1 files changed, 19 insertions, 8 deletions
@@ -3,8 +3,6 @@ Eliminates layout thrashing by batching DOM read/write operations (~750 bytes gzipped). ```js -var fastdom = new FastDom(); - fastdom.read(function() { console.log('read'); }); @@ -40,13 +38,13 @@ write FastDom is CommonJS and AMD compatible, you can install it in one of the following ways: -``` +``` sh $ npm install fastdom ``` -``` +``` sh $ bower install fastdom ``` -``` +``` sh $ component install wilsonpage/fastdom ``` or [download](http://github.com/wilsonpage/fastdom/raw/master/index.js). @@ -83,7 +81,7 @@ fastdom.write(function() { }); ``` -### FastDom#defer(frames, callback[, context]) +### FastDom#defer([frames,] callback[, context]) Defers a job for the number of frames specified. This is useful is you have a particualrly expensive piece of work to do, and don't want it to be done with all the other work. @@ -93,6 +91,19 @@ For example; you are using third party library that doesn't expose an API that a fastdom.defer(3, expensiveStuff); ``` +`FastDom#defer` can also be called with no `frames` argument to push work onto next avaiable frame. + +```js +// Runs in frame 1 +fastdom.defer(expensiveStuff1); + +// Runs in frame 2 +fastdom.defer(expensiveStuff2); + +// Runs in frame 3 +fastdom.defer(expensiveStuff3); +``` + ### FastDom#clear(id) Clears **any** scheduled job by id. @@ -111,7 +122,7 @@ fastdom.clear(defer); #### With PhantomJS -``` +``` sh $ npm install $ npm test ``` @@ -139,4 +150,4 @@ Permission is hereby granted, free of charge, to any person obtaining a copy of The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. -THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
\ No newline at end of file +THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |