mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
35 lines
851 B
JavaScript
35 lines
851 B
JavaScript
![]() |
/**
|
||
|
* Module that notifies user about SyncPlay messages using toasts.
|
||
|
* @module components/syncPlay/syncPlayToasts
|
||
|
*/
|
||
|
|
||
|
import { Events } from 'jellyfin-apiclient';
|
||
|
import toast from '../../toast/toast';
|
||
|
import globalize from '../../../scripts/globalize';
|
||
|
import SyncPlay from 'SyncPlay';
|
||
|
|
||
|
/**
|
||
|
* Class that notifies user about SyncPlay messages using toasts.
|
||
|
*/
|
||
|
class SyncPlayToasts {
|
||
|
constructor() {
|
||
|
// Do nothing.
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* Listens for messages to show.
|
||
|
*/
|
||
|
init() {
|
||
|
Events.on(SyncPlay.Manager, 'show-message', (event, data) => {
|
||
|
const { message, args = [] } = data;
|
||
|
toast({
|
||
|
text: globalize.translate(message, ...args)
|
||
|
});
|
||
|
});
|
||
|
}
|
||
|
}
|
||
|
|
||
|
/** SyncPlayToasts singleton. */
|
||
|
const syncPlayToasts = new SyncPlayToasts();
|
||
|
export default syncPlayToasts;
|