0.0.1 • Published 7 years ago

notify-promise v0.0.1

Weekly downloads
1
License
MIT
Repository
-
Last release
7 years ago

notify-promise

Wrap Promise to support notify.

Install

npm install notify-promise

Usage

import NotifyPromise from 'notify-promise';
const promise = new NotifyPromise((resolve, reject, notify) => {
	notify('message 1');
	notify({ context: 'this is an object!' });
	resolve();
	notify('notify will not trigger when promise finished');
});
  
promise.then(() => {
	console.log('done');
}).notify((message, index) => {
	console.log(`[${index}] Message:`, message);
});
  
// 'message 1'
// { context: 'this is an object!' }
// 'done'