Skip to content

Commit b1724e9

Browse files
committed
refactor(demos): Update process demo; use manualPureFunctions in Rollup config
1 parent b0c6839 commit b1724e9

File tree

2 files changed

+13
-16
lines changed

2 files changed

+13
-16
lines changed

rollup.demos.js

+2-4
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,9 @@ function makeSingleConfig(demo) {
3737
sourcemap: false
3838
},
3939
treeshake: {
40+
// Declare everything Koffi as pure for maximum tree-shakeability.
4041
manualPureFunctions: [
41-
// Declare everything Koffi as pure for maximum tree-shakeability.
42-
'koffi',
43-
// This avoids #__PURE__ annotations everywhere.
44-
// 'Win32Dll'
42+
'koffi'
4543
]
4644
},
4745
plugins: [

source/demos/process.ts

+11-12
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,31 @@
1-
2-
import { CloseHandle, OpenProcess, QueryFullProcessImageName, GetClassName, GetForegroundWindow, GetWindowText, GetWindowThreadProcessId, MessageBox } from "libwin32"
3-
import { PSAR_ } from "../win32/consts/PSAR.js"
1+
import {
2+
GetForegroundWindow, GetWindowThreadProcessId, GetWindowText,
3+
OpenProcess, GetClassName, QueryFullProcessImageName, CloseHandle,
4+
MessageBox
5+
} from 'libwin32'
6+
import { PSAR_ } from 'libwin32/consts'
47

58
const windowHref = GetForegroundWindow()
6-
const processId = GetWindowThreadProcessId(windowHref)
9+
const processId = GetWindowThreadProcessId(windowHref)[0]
710
const windowText = GetWindowText(windowHref)
811

912
const openProcess = OpenProcess(PSAR_.PROCESS_QUERY_INFORMATION | PSAR_.PROCESS_VM_READ, false, processId)
1013
const className = GetClassName(windowHref)
1114

1215
let executable
1316

14-
MessageBox(null, 'Testing2', "libwin32", 0)
15-
if(openProcess){
16-
MessageBox(null, 'Testing', "libwin32", 0)
17+
MessageBox(null, 'Testing2', 'libwin32', 0)
18+
if (openProcess) {
19+
MessageBox(null, 'Testing', 'libwin32', 0)
1720
executable = QueryFullProcessImageName(openProcess, 0)
1821
CloseHandle(openProcess)
1922
}
2023

21-
22-
2324
MessageBox(
2425
null,
2526
`processId: ${processId}\n
2627
windowText: ${windowText}\n
2728
executable: ${executable}\n
2829
className: ${className}\n`,
29-
"libwin32",0
30+
'libwin32', 0
3031
)
31-
32-

0 commit comments

Comments
 (0)