Skip to content

Commit ef30a71

Browse files
committed
fix(toasts): improve code completion with jsdocs
1 parent 6e230d1 commit ef30a71

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

src/toasts/useToasts.js

+12-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,18 @@ export function useToasts() {
55
const toastsState = useContext(ToastsContext);
66

77
return {
8-
showToast(message, { type = 'info', autoClose = 5000, position = 'TOP_RIGHT' } = {}) {
8+
/**
9+
* showToast
10+
* @param {string} message
11+
* @param {object} options Configurations object
12+
* @param {string} options.type toast color based on bootstrap theme ('info' - default, 'success', 'danger', 'warning')
13+
* @param {number} options.autoClose miliseconds to automatically close toast (default 5000)
14+
* @param {string} options.position toast position ('TOP_LEFT', 'TOP_RIGHT' - default, 'BOTTOM_LEFT', 'BOTTOM_RIGHT')
15+
*
16+
* @returns {func} a closeToast function to close the opened toast
17+
*/
18+
showToast(message, options) {
19+
const { type = 'info', autoClose = 5000, position = 'TOP_RIGHT' } = options || {};
920
const toastId = toastsState.show(message, { type, autoClose, position });
1021

1122
return function closeToast() {

0 commit comments

Comments
 (0)