Skip to content

Commit a68a000

Browse files
committed
docs: Update README.md
1 parent ec90984 commit a68a000

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

README.md

+9-7
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,8 @@
44
### In a nutshell:
55
* Very simple and intuitive API (see [demos](./source//demos/)), with TypeScript definitions included.
66
* Bundler friendly, designed with tree-shakeability in mind.
7-
* *Not 100% tree-shakeable right now, but close. And working on it.*
87
* Opinionated:
9-
* Only targets **x64** platforms (*ARM-64 may be added later, no warranty though*).
8+
* Only targets **64-bit** platforms (*Intel/AMD for now, ARM may be added later, no warranty though*).
109
* Only exposes **Unicode** functions and data structures (those whose name ends in `W` in the Win32 API).
1110
* Very easy to extend with additional functions, data structures and constants. I will add some myself time permitting; any help would be *mucho* appreciated.
1211

@@ -15,18 +14,21 @@
1514

1615
#### > Use the lib in your code
1716
1. Install the lib in your project: `npm install libwin32`
18-
1. Import the functions, constants and types you need. You may either import from `libwin32` or from `libwin32/<dllname>` (without the `.dll` extension). Currently, only two dlls are available: `kernel32` and `user32`.
17+
1. Import the functions and types you need. You may either import from `libwin32` or from `libwin32/<dllname>` (without the `.dll` extension) if you know which dll a function beglons to. Currently, only two dlls are available: `kernel32` and `user32`.
18+
1. (optional) Import some complementary constants. They greatly simplify calls to the Win32 API.
19+
* All constants are available via the `libwin32/consts` import.
20+
* Logically grouped constants are exported as `enum`s, where the prefix is the name of the enum. For instance, `WM_DESTROY` and `WM_KEYDOWN` are exported as `WM_.DESTROY` and `WM_.KEYDOWN`, respectively.
1921
1. Call the functions as instructed by the [Win32 API documentation](https://learn.microsoft.com/en-us/windows/win32/api/). All functions, constants and types are named accordingly.
20-
* Constants like `WM_DESTROY` are exported as `enum`s, where the prefix is the name of the enum. For instance, `WM_DESTROY` and `WM_KEYDOWN` are exported as `WM.DESTROY` and `WM.KEYDOWN`, respectively.
2122

2223
````js
23-
import { MessageBox, MB } from 'libwin32'
24+
import { MessageBox } from 'libwin32'
25+
import { MB_ } from 'libwin32/consts'
2426

2527
const result = MessageBox(
2628
null,
2729
"Hello, world!",
2830
"libwin32",
29-
MB.ICONINFORMATION | MB.YESNO
31+
MB_.ICONINFORMATION | MB_.YESNO
3032
)
3133
console.dir(result)
3234
````
@@ -121,4 +123,4 @@ None.
121123
* `./source/demos`:
122124
* Some usage examples.
123125
* `./source/rollup`:
124-
* A [Rollup](https://rollup.org) plugin to ease the process of bundling this library and Koffi with your own code. See [rollup.demo.js](./rollup.demos.js) for an example of usage.
126+
* Two [Rollup](https://rollup.org) plugins to ease the process of bundling this library with your own code and to boost its tree-shakeability. See [rollup.demos.js](./rollup.demos.js) for an example of usage.

0 commit comments

Comments
 (0)