You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

README.md 2.3KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. <p align="center">
  2. <a href="http://gulpjs.com">
  3. <img height="257" width="114" src="https://raw.githubusercontent.com/gulpjs/artwork/master/gulp-2x.png">
  4. </a>
  5. </p>
  6. # default-resolution
  7. [![NPM version][npm-image]][npm-url] [![Downloads][downloads-image]][npm-url] [![Build Status][travis-image]][travis-url] [![AppVeyor Build Status][appveyor-image]][appveyor-url] [![Coveralls Status][coveralls-image]][coveralls-url] [![Gitter chat][gitter-image]][gitter-url]
  8. Get the default resolution time based on the current node version, optionally overridable.
  9. Originally implemented by [@dinoboff][dinoboff] in [gulpjs/undertaker#17][original].
  10. Split out for standalone use.
  11. ## Usage
  12. ```js
  13. var defaultResolution = require('default-resolution');
  14. defaultResolution();
  15. //-> 1000 (1 second) in node 0.10
  16. //-> 1 (millisecond) in node 0.11+
  17. // use a different value
  18. defaultResolution(12);
  19. //-> 12 always
  20. ```
  21. ## API
  22. ### `defaultResolution([resolution])`
  23. Returns the default resolution, based on the node platform. See [Default resolution table][default-table] below for resolutions.
  24. Optionally takes a resolution number to force override any platform resolutions.
  25. ### Default resolutions
  26. | node version | resolution |
  27. |--------------|------------|
  28. | 0.10 | 1s |
  29. | 0.11+ | 1ms |
  30. More information at https://github.com/gulpjs/undertaker/pull/17#issuecomment-82374512
  31. # License
  32. MIT
  33. [dinoboff]: https://github.com/dinoboff
  34. [original]: https://github.com/gulpjs/undertaker/pull/17
  35. [default-table]: #default-resolutions
  36. [downloads-image]: http://img.shields.io/npm/dm/default-resolution.svg
  37. [npm-url]: https://www.npmjs.com/package/default-resolution
  38. [npm-image]: http://img.shields.io/npm/v/default-resolution.svg
  39. [travis-url]: https://travis-ci.org/gulpjs/default-resolution
  40. [travis-image]: http://img.shields.io/travis/gulpjs/default-resolution.svg?label=travis-ci
  41. [appveyor-url]: https://ci.appveyor.com/project/gulpjs/default-resolution
  42. [appveyor-image]: https://img.shields.io/appveyor/ci/gulpjs/default-resolution.svg?label=appveyor
  43. [coveralls-url]: https://coveralls.io/r/gulpjs/default-resolution
  44. [coveralls-image]: http://img.shields.io/coveralls/gulpjs/default-resolution/master.svg
  45. [gitter-url]: https://gitter.im/gulpjs/gulp
  46. [gitter-image]: https://badges.gitter.im/gulpjs/gulp.svg