One promise for multiple requests in flight to avoid async duplication\hypertarget{md_sfcode_node_modules_promise_inflight_README_autotoc_md22267}{}\doxysection{USAGE}\label{md_sfcode_node_modules_promise_inflight_README_autotoc_md22267}

\begin{DoxyCode}{0}
\DoxyCodeLine{const inflight = require('promise-\/inflight')}
\DoxyCodeLine{}
\DoxyCodeLine{// some request that does some stuff}
\DoxyCodeLine{function req(key) \{}
\DoxyCodeLine{  // key is any random string.  like a url or filename or whatever.}
\DoxyCodeLine{  return inflight(key, () => \{}
\DoxyCodeLine{    // this is where you'd fetch the url or whatever}
\DoxyCodeLine{    return Promise.delay(100)}
\DoxyCodeLine{  \})}
\DoxyCodeLine{\}}
\DoxyCodeLine{}
\DoxyCodeLine{// only assigns a single setTimeout}
\DoxyCodeLine{// when it dings, all thens get called with the same result.  (There's only}
\DoxyCodeLine{// one underlying promise.)}
\DoxyCodeLine{req('foo').then(…)}
\DoxyCodeLine{req('foo').then(…)}
\DoxyCodeLine{req('foo').then(…)}
\DoxyCodeLine{req('foo').then(…) }

\end{DoxyCode}
\hypertarget{md_sfcode_node_modules_promise_inflight_README_autotoc_md22268}{}\doxysection{SEE ALSO}\label{md_sfcode_node_modules_promise_inflight_README_autotoc_md22268}

\begin{DoxyItemize}
\item \href{https://npmjs.com/package/inflight}{\texttt{ inflight}} -\/ For the callback based function on which this is based.
\end{DoxyItemize}\hypertarget{md_sfcode_node_modules_promise_inflight_README_autotoc_md22269}{}\doxysection{STILL NEEDS}\label{md_sfcode_node_modules_promise_inflight_README_autotoc_md22269}
Tests! 