react-hook-popup
Advanced tools
Comparing version 0.0.4 to 0.0.5-alpha
@@ -43,3 +43,3 @@ "use strict"; | ||
if (previous[key]) { | ||
throw Error("Alerts were created with duplicate key: '" + key + "'"); | ||
return previous; | ||
} | ||
@@ -53,5 +53,2 @@ return __assign(__assign({}, previous), (_a = {}, _a[key] = { | ||
var removePopup = function (key) { | ||
if (!popups[key]) { | ||
throw Error("Attempted to remove non-existing alert with key: " + key); | ||
} | ||
setPopups(function (previous) { | ||
@@ -64,4 +61,6 @@ var updatedPopups = __assign({}, previous); | ||
var displayPopup = function (key, message) { | ||
var _a; | ||
setPopups(__assign(__assign({}, popups), (_a = {}, _a[key] = __assign(__assign({}, popups[key]), { open: true, message: message }), _a))); | ||
setPopups(function (previous) { | ||
var _a; | ||
return (__assign(__assign({}, previous), (_a = {}, _a[key] = __assign(__assign({}, popups[key]), { open: true, message: message }), _a))); | ||
}); | ||
}; | ||
@@ -68,0 +67,0 @@ var closePopup = function (key) { |
@@ -1,6 +0,3 @@ | ||
declare type ReturnType = [ | ||
(message: string) => void, | ||
() => void | ||
]; | ||
declare type ReturnType = [(message: string) => void, () => void]; | ||
export declare function usePopup(key: string, popupRenderer: PopupRenderer): ReturnType; | ||
export {}; |
{ | ||
"name": "react-hook-popup", | ||
"version": "0.0.4", | ||
"version": "0.0.5-alpha", | ||
"description": "Easily manage popups like alerts and modals in React with a single hook", | ||
@@ -5,0 +5,0 @@ "homepage": "https://github.com/aidanjw1/react-hook-popup#readme", |
9951
171