This is a polyfill of the \href{http://www.ecma-international.org/ecma-262/6.0/\#sec-promise-constructor}{\texttt{ ES6 Promise}}. The implementation is a subset of \href{https://github.com/tildeio/rsvp.js}{\texttt{ rsvp.\+js}} extracted by @jakearchibald, if you\textquotesingle{}re wanting extra features and more debugging options, check out the \href{https://github.com/tildeio/rsvp.js}{\texttt{ full library}}.

For API details and how to use promises, see the \href{http://www.html5rocks.com/en/tutorials/es6/promises/}{\texttt{ Java\+Script Promises HTML5\+Rocks article}}.\hypertarget{md_sfcode_node_modules_es6_promise_README_autotoc_md9165}{}\doxysection{Downloads}\label{md_sfcode_node_modules_es6_promise_README_autotoc_md9165}

\begin{DoxyItemize}
\item \href{https://cdn.jsdelivr.net/npm/es6-promise/dist/es6-promise.js}{\texttt{ es6-\/promise 27.\+86 KB (7.\+33 KB gzipped)}}
\item \href{https://cdn.jsdelivr.net/npm/es6-promise/dist/es6-promise.auto.js}{\texttt{ es6-\/promise-\/auto 27.\+78 KB (7.\+3 KB gzipped)}} -\/ Automatically provides/replaces {\ttfamily Promise} if missing or broken.
\item \href{https://cdn.jsdelivr.net/npm/es6-promise/dist/es6-promise.min.js}{\texttt{ es6-\/promise-\/min 6.\+17 KB (2.\+4 KB gzipped)}}
\item \href{https://cdn.jsdelivr.net/npm/es6-promise/dist/es6-promise.auto.min.js}{\texttt{ es6-\/promise-\/auto-\/min 6.\+19 KB (2.\+4 KB gzipped)}} -\/ Minified version of {\ttfamily es6-\/promise-\/auto} above.
\end{DoxyItemize}\hypertarget{md_sfcode_node_modules_es6_promise_README_autotoc_md9166}{}\doxysection{CDN}\label{md_sfcode_node_modules_es6_promise_README_autotoc_md9166}
To use via a CDN include this in your html\+:


\begin{DoxyCode}{0}
\DoxyCodeLine{<!-\/-\/ Automatically provides/replaces `Promise` if missing or broken. -\/-\/>}
\DoxyCodeLine{<script src="{}https://cdn.jsdelivr.net/npm/es6-\/promise@4/dist/es6-\/promise.js"{}></script>}
\DoxyCodeLine{<script src="{}https://cdn.jsdelivr.net/npm/es6-\/promise@4/dist/es6-\/promise.auto.js"{}></script> }
\DoxyCodeLine{}
\DoxyCodeLine{<!-\/-\/ Minified version of `es6-\/promise-\/auto` below. -\/-\/>}
\DoxyCodeLine{<script src="{}https://cdn.jsdelivr.net/npm/es6-\/promise@4/dist/es6-\/promise.min.js"{}></script>}
\DoxyCodeLine{<script src="{}https://cdn.jsdelivr.net/npm/es6-\/promise@4/dist/es6-\/promise.auto.min.js"{}></script> }

\end{DoxyCode}
\hypertarget{md_sfcode_node_modules_es6_promise_README_autotoc_md9167}{}\doxysection{Node.\+js}\label{md_sfcode_node_modules_es6_promise_README_autotoc_md9167}
To install\+:


\begin{DoxyCode}{0}
\DoxyCodeLine{yarn add es6-\/promise }

\end{DoxyCode}


or


\begin{DoxyCode}{0}
\DoxyCodeLine{npm install es6-\/promise }

\end{DoxyCode}


To use\+:


\begin{DoxyCode}{0}
\DoxyCodeLine{var Promise = require('es6-\/promise').Promise; }

\end{DoxyCode}
\hypertarget{md_sfcode_node_modules_es6_promise_README_autotoc_md9168}{}\doxysection{Usage in IE$<$9}\label{md_sfcode_node_modules_es6_promise_README_autotoc_md9168}
{\ttfamily catch} and {\ttfamily finally} are reserved keywords in IE$<$9, meaning {\ttfamily promise.\+catch(func)} or {\ttfamily promise.\+finally(func)} throw a syntax error. To work around this, you can use a string to access the property as shown in the following example.

However most minifiers will automatically fix this for you, making the resulting code safe for old browsers and production\+:


\begin{DoxyCode}{0}
\DoxyCodeLine{promise['catch'](function(err) \{}
\DoxyCodeLine{  // ...}
\DoxyCodeLine{\}); }

\end{DoxyCode}



\begin{DoxyCode}{0}
\DoxyCodeLine{promise['finally'](function() \{}
\DoxyCodeLine{  // ...}
\DoxyCodeLine{\}); }

\end{DoxyCode}
\hypertarget{md_sfcode_node_modules_es6_promise_README_autotoc_md9169}{}\doxysection{Auto-\/polyfill}\label{md_sfcode_node_modules_es6_promise_README_autotoc_md9169}
To polyfill the global environment (either in Node or in the browser via Common\+JS) use the following code snippet\+:


\begin{DoxyCode}{0}
\DoxyCodeLine{require('es6-\/promise').polyfill(); }

\end{DoxyCode}


Alternatively


\begin{DoxyCode}{0}
\DoxyCodeLine{require('es6-\/promise/auto'); }

\end{DoxyCode}


Notice that we don\textquotesingle{}t assign the result of {\ttfamily polyfill()} to any variable. The {\ttfamily polyfill()} method will patch the global environment (in this case to the {\ttfamily Promise} name) when called.\hypertarget{md_sfcode_node_modules_es6_promise_README_autotoc_md9170}{}\doxysection{Building \& Testing}\label{md_sfcode_node_modules_es6_promise_README_autotoc_md9170}
You will need to have Phantom\+JS installed globally in order to run the tests.

{\ttfamily npm install -\/g phantomjs}


\begin{DoxyItemize}
\item {\ttfamily npm run build} to build
\item {\ttfamily npm test} to run tests
\item {\ttfamily npm start} to run a build watcher, and webserver to test
\item {\ttfamily npm run test\+:server} for a testem test runner and watching builder 
\end{DoxyItemize}