-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix #23: Added to vue instance the plugin name without $.
- Loading branch information
1 parent
1d5f04f
commit 15fb0c2
Showing
2 changed files
with
73 additions
and
48 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,58 +1,74 @@ | ||
import Vue, { PluginFunction } from 'vue'; | ||
|
||
export class VueIzitoast { | ||
constructor(options?: VueIzitoastOptions); | ||
|
||
static install(): PluginFunction<any>; | ||
static init(Vue: Vue): void; | ||
|
||
public show(message: string, title: string, options: VueIzitoastOptions): void; | ||
public hide(toast: string | HTMLDivElement | null, options: VueIzitoastOptions): void; | ||
public progress(toast: string | HTMLDivElement | null, options: VueIzitoastOptions, callback: () => void): void; | ||
public destroy(): void; | ||
public info(message: string, title: string, options: VueIzitoastOptions): void; | ||
public success(message: string, title: string, options: VueIzitoastOptions): void; | ||
public warning(message: string, title: string, options: VueIzitoastOptions): void; | ||
public error(message: string, title: string, options: VueIzitoastOptions): void; | ||
public question(message: string, title: string, options: VueIzitoastOptions): void; | ||
public on<CB>(eventName: string, callback: CB): void; | ||
public off<CB>(eventName: string, callback: CB): void; | ||
constructor(options?: VueIzitoastOptions); | ||
|
||
static install(): PluginFunction<any>; | ||
|
||
static init(Vue: Vue): void; | ||
|
||
public show(message: string, title: string, options: VueIzitoastOptions): void; | ||
|
||
public hide(toast: string | HTMLDivElement | null, options: VueIzitoastOptions): void; | ||
|
||
public progress(toast: string | HTMLDivElement | null, options: VueIzitoastOptions, callback: () => void): void; | ||
|
||
public destroy(): void; | ||
|
||
public info(message: string, title: string, options: VueIzitoastOptions): void; | ||
|
||
public success(message: string, title: string, options: VueIzitoastOptions): void; | ||
|
||
public warning(message: string, title: string, options: VueIzitoastOptions): void; | ||
|
||
public error(message: string, title: string, options: VueIzitoastOptions): void; | ||
|
||
public question(message: string, title: string, options: VueIzitoastOptions): void; | ||
|
||
public on<CB>(eventName: string, callback: CB): void; | ||
|
||
public off<CB>(eventName: string, callback: CB): void; | ||
} | ||
|
||
export interface VueIzitoastOptions { | ||
zindex: number; | ||
layout: number; | ||
balloon: boolean; | ||
close: boolean; | ||
closeOnEscape: boolean; | ||
rtl: boolean; | ||
position: string; | ||
timeout: number; | ||
animateInside: boolean; | ||
drag: boolean; | ||
pauseOnHover: boolean; | ||
resetOnHover: boolean; | ||
transitionIn: string; | ||
transitionOut: string; | ||
transitionInMobile: string; | ||
transitionOutMobile: string; | ||
buttons: unknown; | ||
inputs: unknown; | ||
onOpening: () => void; | ||
onOpened: () => void; | ||
onClosing: () => void; | ||
onClosed: () => void; | ||
zindex: number; | ||
layout: number; | ||
balloon: boolean; | ||
close: boolean; | ||
closeOnEscape: boolean; | ||
rtl: boolean; | ||
position: string; | ||
timeout: number; | ||
animateInside: boolean; | ||
drag: boolean; | ||
pauseOnHover: boolean; | ||
resetOnHover: boolean; | ||
transitionIn: string; | ||
transitionOut: string; | ||
transitionInMobile: string; | ||
transitionOutMobile: string; | ||
buttons: unknown; | ||
inputs: unknown; | ||
onOpening: () => void; | ||
onOpened: () => void; | ||
onClosing: () => void; | ||
onClosed: () => void; | ||
} | ||
|
||
// https://vuejs.org/v2/guide/typescript.html#Augmenting-Types-for-Use-with-Plugins | ||
declare module 'vue/types/vue' { | ||
interface Vue { | ||
$toast: VueIzitoast; | ||
__$VueIzitoastInstance: VueIzitoast; | ||
} | ||
interface Vue { | ||
$toast: VueIzitoast; | ||
__$VueIzitoastInstance: VueIzitoast; | ||
} | ||
|
||
interface VueConstructor { | ||
toast: VueIzitoast; | ||
} | ||
} | ||
|
||
declare module 'vue/types/options' { | ||
interface ComponentOptions<V extends Vue> { | ||
vueIzitoastSettings?: VueIzitoastOptions | VueIzitoast | ||
} | ||
interface ComponentOptions<V extends Vue> { | ||
vueIzitoastSettings?: VueIzitoastOptions | VueIzitoast | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters