1
0
Fork 0
mirror of https://github.com/jellyfin/jellyfin-web synced 2025-03-30 19:56:21 +00:00
jellyfin-web/dashboard-ui/bower_components/emby-webcomponents/toast/toast.js

25 lines
647 B
JavaScript
Raw Normal View History

2016-02-16 11:15:36 -05:00
define(['paper-toast'], function () {
var toastId = 0;
return function (options) {
2016-02-25 01:38:12 -05:00
if (typeof options === 'string') {
options = {
text: options
};
}
2016-02-16 11:15:36 -05:00
var elem = document.createElement("paper-toast");
elem.setAttribute('text', options.text);
elem.id = 'toast' + (toastId++);
document.body.appendChild(elem);
// This timeout is obviously messy but it's unclear how to determine when the webcomponent is ready for use
// element onload never fires
setTimeout(function () {
elem.show();
}, 300);
};
});