Add parameters to callbacks for bootstrap-notify

This commit is contained in:
Joan Karadimov 2019-02-20 18:07:42 +02:00
parent fd67ee7268
commit de1439e667
2 changed files with 23 additions and 6 deletions

View File

@ -46,4 +46,21 @@ $.notify({
'</div>' +
'<a href="{3}" target="{4}" data-notify="url"></a>' +
'</div>'
});
});
const notifyResult = $.notify({
message: 'Callbacks have the popup element as an argument',
},{
onShow: function($ele) {
notifyResult.$ele === $ele;
},
onShown: function($ele) {
notifyResult.$ele === $ele;
},
onClose: function($ele) {
notifyResult.$ele === $ele;
},
onClosed: function($ele) {
notifyResult.$ele === $ele;
},
});

View File

@ -48,16 +48,16 @@ interface NotifySettings {
enter?: string;
exit?: string;
};
onShow?: () => void;
onShown?: () => void;
onClose?: () => void;
onClosed?: () => void;
onShow?: ($ele: JQuery) => void;
onShown?: ($ele: JQuery) => void;
onClose?: ($ele: JQuery) => void;
onClosed?: ($ele: JQuery) => void;
icon_type?: string;
template?: string;
}
interface NotifyReturn {
$ele: JQueryStatic;
$ele: JQuery;
close: () => void;
update: (command: string, update: any) => void;
}