Skip to content

Commit

Permalink
update README.md Araxeus#6
Browse files Browse the repository at this point in the history
  • Loading branch information
lysdexic-audio committed Mar 19, 2022
1 parent 6c96ea3 commit c7b6558
Showing 1 changed file with 53 additions and 50 deletions.
103 changes: 53 additions & 50 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Custom Electron Prompt

[![NPM Version](https://img.shields.io/npm/v/custom-electron-prompt)](https://www.npmjs.com/package/custom-electron-prompt)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://github.com/Araxeus/custom-electron-prompt/blob/main/LICENSE)
[![NPM Version](https://img.shields.io/npm/v/custom-electron-prompt)](https://www.npmjs.com/package/custom-electron-prompt)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://github.com/Araxeus/custom-electron-prompt/blob/main/LICENSE)
[![Maintenance](https://img.shields.io/badge/Maintained%3F-yes-green.svg)](https://github.com/Araxeus/custom-electron-prompt)
[![Website shields.io](https://img.shields.io/website-up-down-green-red/http/shields.io.svg)](https://araxeus.github.io/custom-electron-prompt)

Expand All @@ -19,7 +19,7 @@ There is also an option for a button with user-defined `onclick` function.

## Usage

* 1: Install the npm package to your project directory with
* 1: Install the npm package to your project directory with
```bash
npm install custom-electron-prompt
```
Expand All @@ -29,19 +29,19 @@ There is also an option for a button with user-defined `onclick` function.
```

* 2: Import prompt

```javascript
const prompt = require('custom-electron-prompt')
```

* 3: Create a prompt

```javascript
prompt([options, parentBrowserWindow])
```

calling the prompt function returns a Promise

Promise resolve returns the input or returns null if prompt was canceled

       On error, Prompise reject returns custom error message
Expand Down Expand Up @@ -87,15 +87,15 @@ keybindOptions: [
]
```

Return an array made of objects in format
Return an array made of objects in format

`{value: "copyAccelerator", accelerator: "Ctrl+Shift+Insert"}`
`{value: "copyAccelerator", accelerator: "Ctrl+Shift+Insert"}`

where `accelerator` is the input for the `value` you registered

<details>
<summary> Code Example </summary>

```javascript
const kb = ($value, $label, $default) => { return { value: $value, label: $label, default: $default } };
prompt({
Expand All @@ -119,7 +119,7 @@ prompt({
.catch(console.error)
```
</details>

<details>
<summary> Screenshots </summary>

Expand Down Expand Up @@ -150,7 +150,7 @@ counterOptions: {

<details>
<summary> Code Example </summary>

```javascript
prompt({
title: "Counter",
Expand All @@ -165,7 +165,7 @@ prompt({
}, win).then(input => console.log(`input == ${input}`)).catch(console.error)
```
</details>

<details>
<summary> Screenshots </summary>

Expand Down Expand Up @@ -193,7 +193,7 @@ Must specify selectOptions with valid entries in **one** of the following format

<details>
<summary> Code Example </summary>

```javascript
prompt({
title: "Select",
Expand All @@ -209,7 +209,7 @@ prompt({
}, win).then(input => console.log(`input == ${input}`)).catch(console.error)
```
</details>

<details>
<summary> Screenshots </summary>

Expand Down Expand Up @@ -237,48 +237,51 @@ Must specify multiInputOptions with valid entries in the following format:

<details>
<summary> Code Example </summary>

```javascript
prompt({
title: "credentials",
label: "Please enter username and password",
type: "multiInput",
multiInputOptions:
[{
inputAttrs:
{
type: "email",
required: true,
placeholder: "email"
}
},
{
value: "2",
selectOptions: ["thisReturn0", "thisReturn1", "imSelected", "thisReturn3"],
// selectOptions: {0: "thisReturn0", 1: "thisReturn1", 2: "imSelected" , potato: "thisReturnPotato"},
},
{
inputAttrs:
{
type: "password",
placeholder: "password"
}
}],
resizable: true,
height: 150,
width: 300,
title: "credentials",
label: "Login Info:",
type: "multiInput",
multiInputOptions:
[
{
inputAttrs:
{
type: "email",
required: true,
placeholder: "email"
}
},
{
inputAttrs:
{
type: "password",
placeholder: "password"
}
},
{
selectOptions: { na: "North America", eu: "Europe", other: "Other" },
value: "2"
}
],
resizable: true,
width: 300,
height: 225,
}, win).then(input => console.log(`input == ${input}`)).catch(console.error)
```
</details>

<details>
<summary> Screenshots </summary>

![](https://github.com/amunim/custom-electron-prompt/blob/main/screenshots/multiInput/button.PNG)


This screenshot also contains a custom button.


![](screenshots/multiInput/multiInputSelect.PNG)

</details>

----
Expand Down Expand Up @@ -345,8 +348,8 @@ Adds an extra/custom button with special functionalities other than success or e

<details>
<summary> Code Example </summary>


```javascript
await prompt({
title: 'Login credentials',
Expand Down Expand Up @@ -378,7 +381,7 @@ await prompt({
button:
{
label: "Autofill",
click: () =>
click: () =>
{
document.querySelectorAll("#data")[0].value = "mama@young.com";
document.querySelectorAll("#data")[1].value = "mysecretrecipe";
Expand All @@ -395,8 +398,8 @@ await prompt({

<details>
<summary> Screenshots </summary>


![](https://github.com/amunim/custom-electron-prompt/blob/main/screenshots/multiInput/button.PNG)
</details>

Expand Down

0 comments on commit c7b6558

Please sign in to comment.