@resourge/react-fetch
Version:
[](LICENSE)
40 lines (38 loc) • 801 B
JavaScript
/**
* react-fetch v1.43.1
*
* Copyright (c) resourge.
*
* This source code is licensed under the MIT license found in the
* LICENSE.md file in the root directory of this source tree.
*
* @license MIT
*/
const notifications = new Map();
const NotificationService = {
subscribe(id) {
return notification => {
notifications.set(id, {
notification
});
return () => {
notifications.delete(id);
};
};
},
notifyAll() {
notifications.forEach(({
notification
}) => {
notification();
});
},
notifyById(id) {
const notification = notifications.get(id);
if (notification) {
notification.notification();
}
}
};
export { NotificationService as default };
//# sourceMappingURL=NotificationService.js.map