0.0.1 • Published 4 years ago

resolve-last v0.0.1

Weekly downloads
2
License
MIT
Repository
github
Last release
4 years ago

resolve-last

Build Status NPM Version NPM Downloads MIT License Standard Version Codecov

👌Only resolve last promise

Install

yarn add resolve-last
// or
npm install resolve-last

Usage

import resolveLast from 'resolve-last';

// yourAsyncFunction: (...args: Arguments) => Promise<Result>
const resolveLastAsyncFunction = resolveLast(yourAsyncFunction);

button.addEventListener('click', async function(e) {
  await resolveLastAsyncFunction(...args);
  // `console.log` only run with last called args
  console.log('resolved with ' + args.join(', '));
});

(Project created by create-n.)