Skip to content

Commit d9bb48b

Browse files
authored
Merge pull request #19 from SkwalExe/fix-typing
fix typing
2 parents 64851e3 + 49a08f9 commit d9bb48b

File tree

5 files changed

+15
-8
lines changed

5 files changed

+15
-8
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
# 0.1.3 - 2024-05-25
2+
3+
### Fixed
4+
- Type errors
5+
16
# 0.1.2 - 2024-05-10
27

38
### Fixed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ import WinMB from '@skwalexe/winmb'
4848
If you use this method, the library will be available globally as `WinMB`.
4949

5050
```js
51-
<script src="https://cdn.jsdelivr.net/npm/@skwalexe/[email protected].2/dist/winmb.umd.js"></script>
51+
<script src="https://cdn.jsdelivr.net/npm/@skwalexe/[email protected].3/dist/winmb.umd.js"></script>
5252
```
5353

5454
# Using this library 📦
@@ -58,7 +58,7 @@ This library exports a `WinMB` class which acccepts the following parameters:
5858
- `assetsUrl / required`: WinMB needs to load **remote assets** such as css stylesheets, sounds, and images, which you can host on your own servers. This parameter is used to tell WinMB where it can find these assets. You must provide a **base url**, to which WinMB will just append the requested asset's file name. If you don't want to host the assets yourself, you can use JSDelivr like in the example below.
5959

6060
```js
61-
const wmbEngine = WinMB('https://cdn.jsdelivr.net/gh/SkwalExe/[email protected].2/src/assets/')
61+
const wmbEngine = WinMB('https://cdn.jsdelivr.net/gh/SkwalExe/[email protected].3/src/assets/')
6262
```
6363

6464
Once you instanciated the `WinMB` class, it exposes the follwing methods:

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@skwalexe/winmb",
3-
"version": "0.1.2",
3+
"version": "0.1.3",
44
"description": "Windows-like dialogue boxes for your website",
55
"main": "./dist/lib-cjs/main.js",
66
"module": "./dist/lib-esm/main.js",

src/winmb.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,11 @@ const cssFileName = 'winmb.css'
66
// Must be the same as in winmb.css
77
const cssClass = 'winmb'
88

9-
interface Button {
9+
type ButtonValue = string | number | boolean
10+
11+
type Button = {
1012
text: string
11-
value: string | number | boolean
13+
value?: ButtonValue
1214
}
1315

1416
export default class WinMB {
@@ -57,7 +59,7 @@ export default class WinMB {
5759
type: string = 'error',
5860
buttons: Button[] = [{text: 'ok', value: true}],
5961
position: string | Array<number> = 'default'
60-
): Promise<boolean | string | number> => {
62+
): Promise<ButtonValue> => {
6163
if (typeof position === 'string' && !['random', 'default'].includes(position))
6264
throw new Error(
6365
'Position must be either "random", "default", or an array of two numbers [x, y].'

0 commit comments

Comments
 (0)