Given a function like the following, what is the correct syntax to use in order to be able to call showToast({ text: "some text"})
and still get the default values for params.autoHide
and params.action
?
function showToast (params = {text: 'Something happened!', autoHide: false, action: 'CLOSE'}) {
//noinspection JSUnresolvedFunction
const toast = $mdToast.simple()
.textContent(params.text)
.position('top right')
;
if (!params.autoHide) {
toast.hideDelay(false);
}
if (params.action) {
//noinspection JSValidateTypes
toast.action(params.action); // label for close btn
}
$mdToast.show(toast);
}