Skip to content

Commit

Permalink
1.0.2
Browse files Browse the repository at this point in the history
  • Loading branch information
hvlxh committed Jul 21, 2023
1 parent 91bb996 commit 4a3232d
Show file tree
Hide file tree
Showing 6 changed files with 1,397 additions and 68 deletions.
4 changes: 2 additions & 2 deletions examples/test.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
const { Dialog } = require('../index')
const { ButtonClickedTypes } = require('../src/DialogTypes')
const { Dialog, ButtonClickedTypes } = require('../index')

const dialog = new Dialog({
title: "Title",
message: "Hello"
})

const value = dialog.run()
if(value === ButtonClickedTypes.Ok) {
dialog.run()
Expand Down
63 changes: 63 additions & 0 deletions index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
declare module "node-dialogs" {
interface DialogOptions {
title: string
message: string
buttonType: string
iconType: string
defaultButtonType: string
}

export enum ButtonTypes {
AbortRetryIgnore = "ABORT_RETRY_IGNORE",
CancelTryContinue = "CANCEL_TRY_CONTINUE",
Ok = "OK",
OkCancel = "OK_CANCEL",
RetryCancel = "RETRY_CANCEL",
YesNo = "YES_NO",
YesNoCancel = "YES_NO_CANCEL",
}

export enum IconTypes {
Information = "INFORMATION",
Error = "ERROR",
Stop = "ERROR",
Warning = "WARNING",
Exclamation = "WARNING",
Question = "QUESTION",
}

export enum DefaultButtonTypes {
One = "DEFAULT_1",
Two = "DEFAULT_2",
Three = "DEFAULT_3",
Four = "DEFAULT_4",
}

export enum ButtonClickedTypes {
Ok = 1,
Cancel = 2,
Abort = 3,
Retry = 4,
Ignore = 5,
Yes = 6,
No = 7,
TryAgain = 10,
Continue = 11,
}

export class Dialog {
private title: string
private message: string
private buttonType: string
private iconType: string
private defaultButtonType: string

constructor(title: string | DialogOptions, message: string, buttonType: string, iconType: string, defaultButtonType: string)
run(): ButtonClickedTypes
setTitle(title: string): Dialog
setMessage(message: string): Dialog
setButtonType(buttonType: string): Dialog
setIconType(iconType: string): Dialog
setDefaultButtonType(defaultButtonType: string): Dialog
}
}
Loading

0 comments on commit 4a3232d

Please sign in to comment.