Software zum Installieren eines Smart-Mirror Frameworks , zum Nutzen von hochschulrelevanten Informationen, auf einem Raspberry-Pi.
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.6KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. <h1 align="center">
  2. <br>
  3. <img width="256" src="media/logo.png" alt="pinkie">
  4. <br>
  5. <br>
  6. </h1>
  7. > Itty bitty little widdle twinkie pinkie [ES2015 Promise](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-promise-objects) implementation
  8. [![Build Status](https://travis-ci.org/floatdrop/pinkie.svg?branch=master)](https://travis-ci.org/floatdrop/pinkie) [![Coverage Status](https://coveralls.io/repos/floatdrop/pinkie/badge.svg?branch=master&service=github)](https://coveralls.io/github/floatdrop/pinkie?branch=master)
  9. There are [tons of Promise implementations](https://github.com/promises-aplus/promises-spec/blob/master/implementations.md#standalone) out there, but all of them focus on browser compatibility and are often bloated with functionality.
  10. This module is an exact Promise specification polyfill (like [native-promise-only](https://github.com/getify/native-promise-only)), but in Node.js land (it should be browserify-able though).
  11. ## Install
  12. ```
  13. $ npm install --save pinkie
  14. ```
  15. ## Usage
  16. ```js
  17. var fs = require('fs');
  18. var Promise = require('pinkie');
  19. new Promise(function (resolve, reject) {
  20. fs.readFile('foo.json', 'utf8', function (err, data) {
  21. if (err) {
  22. reject(err);
  23. return;
  24. }
  25. resolve(data);
  26. });
  27. });
  28. //=> Promise
  29. ```
  30. ### API
  31. `pinkie` exports bare [ES2015 Promise](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-promise-objects) implementation and polyfills [Node.js rejection events](https://nodejs.org/api/process.html#process_event_unhandledrejection). In case you forgot:
  32. #### new Promise(executor)
  33. Returns new instance of `Promise`.
  34. ##### executor
  35. *Required*
  36. Type: `function`
  37. Function with two arguments `resolve` and `reject`. The first argument fulfills the promise, the second argument rejects it.
  38. #### pinkie.all(promises)
  39. Returns a promise that resolves when all of the promises in the `promises` Array argument have resolved.
  40. #### pinkie.race(promises)
  41. Returns a promise that resolves or rejects as soon as one of the promises in the `promises` Array resolves or rejects, with the value or reason from that promise.
  42. #### pinkie.reject(reason)
  43. Returns a Promise object that is rejected with the given `reason`.
  44. #### pinkie.resolve(value)
  45. Returns a Promise object that is resolved with the given `value`. If the `value` is a thenable (i.e. has a then method), the returned promise will "follow" that thenable, adopting its eventual state; otherwise the returned promise will be fulfilled with the `value`.
  46. ## Related
  47. - [pinkie-promise](https://github.com/floatdrop/pinkie-promise) - Returns the native Promise or this module
  48. ## License
  49. MIT © [Vsevolod Strukchinsky](http://github.com/floatdrop)