mirror of
https://github.com/codex-team/editor.js
synced 2024-06-07 16:32:22 +02:00
Update notifier.ts
This commit is contained in:
parent
9b51621836
commit
bcb0999b24
|
@ -1,15 +1,38 @@
|
|||
import { Notifier } from '../../../../types/api';
|
||||
import EventsDispatcher from '../../utils/events';
|
||||
import { Notifier as INotifier } from '../../../../types/api';
|
||||
import Notifier from '../../utils/notifier';
|
||||
import { ConfirmNotifierOptions, NotifierOptions, PromptNotifierOptions } from 'codex-notifier';
|
||||
import Module from '../../__module';
|
||||
import { ModuleConfig } from '../../../types-internal/module-config';
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
export default class NotifierAPI extends Module {
|
||||
/**
|
||||
* Notifier utility Instance
|
||||
*/
|
||||
private notifier: Notifier;
|
||||
|
||||
/**
|
||||
* @class
|
||||
* @param {object} moduleConfiguration - Module Configuration
|
||||
* @param {EditorConfig} moduleConfiguration.config - Editor's config
|
||||
* @param {EventsDispatcher} moduleConfiguration.eventsDispatcher - Editor's event dispatcher
|
||||
*/
|
||||
constructor({ config, eventsDispatcher }: ModuleConfig) {
|
||||
super({
|
||||
config,
|
||||
eventsDispatcher,
|
||||
});
|
||||
|
||||
this.notifier = new Notifier();
|
||||
}
|
||||
|
||||
/**
|
||||
* Available methods
|
||||
*/
|
||||
public get methods(): Notifier {
|
||||
public get methods(): INotifier {
|
||||
return {
|
||||
show: (options: NotifierOptions | ConfirmNotifierOptions | PromptNotifierOptions): void => this.show(options),
|
||||
};
|
||||
|
@ -21,6 +44,6 @@ export default class NotifierAPI extends Module {
|
|||
* @param {NotifierOptions} options - message option
|
||||
*/
|
||||
public show(options: NotifierOptions | ConfirmNotifierOptions | PromptNotifierOptions): void {
|
||||
return this.Editor.Notifier.show(options);
|
||||
return this.notifier.show(options);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue