Server IP : 185.86.78.101 / Your IP : 216.73.216.124 Web Server : Apache System : Linux 675867-vds-valikoshka1996.gmhost.pp.ua 5.4.0-150-generic #167-Ubuntu SMP Mon May 15 17:35:05 UTC 2023 x86_64 User : www ( 1000) PHP Version : 7.4.33 Disable Function : passthru,exec,system,putenv,chroot,chgrp,chown,shell_exec,popen,proc_open,pcntl_exec,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,imap_open,apache_setenv MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : OFF Directory : /www/wwwroot/mifepriston.org/node_modules/pinkie/ |
Upload File : |
<h1 align="center"> <br> <img width="256" src="media/logo.png" alt="pinkie"> <br> <br> </h1> > Itty bitty little widdle twinkie pinkie [ES2015 Promise](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-promise-objects) implementation [](https://travis-ci.org/floatdrop/pinkie) [](https://coveralls.io/github/floatdrop/pinkie?branch=master) 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. 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). ## Install ``` $ npm install --save pinkie ``` ## Usage ```js var fs = require('fs'); var Promise = require('pinkie'); new Promise(function (resolve, reject) { fs.readFile('foo.json', 'utf8', function (err, data) { if (err) { reject(err); return; } resolve(data); }); }); //=> Promise ``` ### API `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: #### new Promise(executor) Returns new instance of `Promise`. ##### executor *Required* Type: `function` Function with two arguments `resolve` and `reject`. The first argument fulfills the promise, the second argument rejects it. #### pinkie.all(promises) Returns a promise that resolves when all of the promises in the `promises` Array argument have resolved. #### pinkie.race(promises) 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. #### pinkie.reject(reason) Returns a Promise object that is rejected with the given `reason`. #### pinkie.resolve(value) 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`. ## Related - [pinkie-promise](https://github.com/floatdrop/pinkie-promise) - Returns the native Promise or this module ## License MIT © [Vsevolod Strukchinsky](http://github.com/floatdrop)