layerpro
Version:
Custom popups, alert, confirm, prompt... by Dario Passariello
108 lines (84 loc) • 2.75 kB
TypeScript
/*!
layerpro
Copyright (c) 2019 Dario Passariello <dariopassariello@gmail.com>
Licensed under MIT License, see
https://dario.passariello.ca
*/
/** Generate custom alert using alert([text]) */
declare function alert(f1?: string): any
/** Generate custom confirm using confirm([text],[callback for YES],[optional callback for NO]) */
declare function confirm(message: string, func1: Function, func2?: Function): boolean
/** Generate custom message using message([text],[callback]) and option callback */
declare function message(f1?: string, func1?: Function): any
/** Generate custom message using message([text],[callback]) and option callback */
declare function prompt(f1?: string, func1?: Function): any
////////////////////////////////////////////////////////////////////////////////////
interface GenLayerProps {
id: string
body?: any
name?: string
style?: any
class?: string
icon?: string
buttons?: {
confirm?: {
text: string
cb?: () => void
}
cancel?: {
text: string
cb?: () => void
}
}
top?: number | string
left?: number | string
right?: number | string
bottom?: number | string
width?: number | string
height?: number | string
minWidth?: number
minHeight?: number
maxWidth?: number
maxHeight?: number
fadeIn?: number
fadeOut?: number
timer?: number
maximize?: boolean
isMaximize?: boolean
dockable?: boolean
movable?: boolean
resizable?: boolean
close?: boolean
raised?: boolean
iconize?: boolean
source?: string
store?: any
}
/**
* Interface for the layerpro object
*/
interface _layerpro {
readonly alert: (txt: string) => void
readonly prompt: (txt: string, callback: (input: string) => void, event: Event) => void
readonly message: (txt: string, callback: () => void) => void
readonly confirm: (txt: string, yesCallback: () => void, noCallback: () => void) => void
readonly purge: (document: Document) => void
readonly credits: (txt: string) => void
readonly popup: {
readonly open: (props: GenLayerProps) => GenLayerProps
readonly center: (props: any) => void
readonly maximize: (props: any) => void
readonly iconize: (props: any) => void
readonly raised: (props: any) => void
readonly movable: (props: any) => void
readonly resizable: (props: any) => void
readonly dockable: (props: any) => void
readonly store: (props: any) => void
readonly index: (props: any) => void
readonly zIndex: (props: any) => number
readonly close: (props: any) => any
}
}
declare var layerpro: _layerpro
type layerpro = _layerpro
type process = {}