measur-tools-suite 1.2.1-beta.1 → 1.2.1-beta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/BUILD.md +22 -16
- package/README.md +30 -1
- package/bin/package.json +2 -1
- package/package.json +2 -1
package/BUILD.md
CHANGED
|
@@ -179,32 +179,38 @@ Artifacts appear under `bin/`
|
|
|
179
179
|
|
|
180
180
|
### 6.5 WebAssembly Usage Example
|
|
181
181
|
|
|
182
|
-
```
|
|
182
|
+
```ts
|
|
183
|
+
import type { WallHeatLossModule, DryerOperatingCostModule } from 'measur-tools-suite';
|
|
184
|
+
|
|
183
185
|
// Initialize module
|
|
184
186
|
const moduleFactory = (await import('/path/to/client.js')).default;
|
|
185
187
|
const toolsSuiteModule = await moduleFactory({
|
|
186
188
|
locateFile: (filename) => '/path/to/client.wasm'
|
|
187
189
|
});
|
|
188
190
|
|
|
189
|
-
// Example
|
|
191
|
+
// Example 1: wallTotalHeatLoss — returns a number directly
|
|
190
192
|
const totalHeatLoss = toolsSuiteModule.wallTotalHeatLoss(
|
|
191
193
|
500, 80, 225, 10, 0.9, 1.394, 1
|
|
192
194
|
);
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
const
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
195
|
+
console.log('Wall total heat loss:', totalHeatLoss);
|
|
196
|
+
|
|
197
|
+
// Alternatively, narrow to a typed sub-module for IDE assistance
|
|
198
|
+
const wallLossModule = toolsSuiteModule as unknown as WallHeatLossModule;
|
|
199
|
+
const wthl = wallLossModule.wallTotalHeatLoss(500, 80, 225, 10, 0.9, 1.394, 1);
|
|
200
|
+
console.log('Wall total heat loss (typed):', wthl);
|
|
201
|
+
|
|
202
|
+
// Example 2: DryerOperatingCost — plain usage
|
|
203
|
+
// Enum values and constructors come from the live module instance
|
|
204
|
+
const docRes = new toolsSuiteModule.DryerOperatingCost(1752, 50, 100, 24, 7, 52, 0.08, 0.2, 0.25)
|
|
205
|
+
.calculate(toolsSuiteModule.DryerType.Heatless);
|
|
206
|
+
console.log('DryerOperatingCost => Water Removed:', docRes.waterRemoved);
|
|
201
207
|
docRes.delete();
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
console.log(
|
|
208
|
+
|
|
209
|
+
// Alternatively, narrow to a typed sub-module for IDE assistance
|
|
210
|
+
const dryerModule = toolsSuiteModule as unknown as DryerOperatingCostModule;
|
|
211
|
+
const doc = new dryerModule.DryerOperatingCost(1752, 50, 100, 24, 7, 52, 0.08, 0.2, 0.25);
|
|
212
|
+
const res = doc.calculate(dryerModule.DryerType.Heatless);
|
|
213
|
+
console.log('DryerOperatingCost => Water removed:', res.waterRemoved);
|
|
208
214
|
res.delete();
|
|
209
215
|
doc.delete();
|
|
210
216
|
```
|
package/README.md
CHANGED
|
@@ -25,6 +25,8 @@ Check out the [Master List of MEASUR Calculators](https://github.com/ORNL-AMO/AM
|
|
|
25
25
|
npm install measur-tools-suite
|
|
26
26
|
```
|
|
27
27
|
|
|
28
|
+
**JavaScript**
|
|
29
|
+
|
|
28
30
|
```js
|
|
29
31
|
// Initialize module
|
|
30
32
|
const moduleFactory = (await import('/path/to/client.js')).default;
|
|
@@ -32,10 +34,37 @@ const toolsSuiteModule = await moduleFactory({
|
|
|
32
34
|
locateFile: (filename) => '/path/to/client.wasm'
|
|
33
35
|
});
|
|
34
36
|
|
|
35
|
-
//
|
|
37
|
+
// Plain function call — returns a number directly
|
|
36
38
|
const totalHeatLoss = toolsSuiteModule.wallTotalHeatLoss(
|
|
37
39
|
500, 80, 225, 10, 0.9, 1.394, 1
|
|
38
40
|
);
|
|
41
|
+
console.log('Wall total heat loss:', totalHeatLoss);
|
|
42
|
+
|
|
43
|
+
// Class-based API — always call delete() to free WASM memory
|
|
44
|
+
const doc = new toolsSuiteModule.DryerOperatingCost(1752, 50, 100, 24, 7, 52, 0.08, 0.2, 0.25);
|
|
45
|
+
const res = doc.calculate(toolsSuiteModule.DryerType.Heatless);
|
|
46
|
+
console.log('Water removed:', res.waterRemoved);
|
|
47
|
+
res.delete();
|
|
48
|
+
doc.delete();
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
**TypeScript** — named `import type` provides IDE autocompletion with zero runtime cost; enum values and constructors still come from the live module instance.
|
|
52
|
+
|
|
53
|
+
```ts
|
|
54
|
+
import type { DryerOperatingCostModule } from 'measur-tools-suite';
|
|
55
|
+
|
|
56
|
+
const moduleFactory = (await import('/path/to/client.js')).default;
|
|
57
|
+
const toolsSuiteModule = await moduleFactory({
|
|
58
|
+
locateFile: (filename) => '/path/to/client.wasm'
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
// Narrow to the typed sub-module for full IDE assistance
|
|
62
|
+
const dryerModule = toolsSuiteModule as unknown as DryerOperatingCostModule;
|
|
63
|
+
const doc = new dryerModule.DryerOperatingCost(1752, 50, 100, 24, 7, 52, 0.08, 0.2, 0.25);
|
|
64
|
+
const res = doc.calculate(dryerModule.DryerType.Heatless);
|
|
65
|
+
console.log('Water removed:', res.waterRemoved);
|
|
66
|
+
res.delete();
|
|
67
|
+
doc.delete();
|
|
39
68
|
```
|
|
40
69
|
|
|
41
70
|
### Building from Source
|
package/bin/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "measur-tools-suite",
|
|
3
|
-
"version": "1.2.1-beta.
|
|
3
|
+
"version": "1.2.1-beta.2",
|
|
4
4
|
"engines": {
|
|
5
5
|
"node": "20.19.4",
|
|
6
6
|
"npm": "10.8.2"
|
|
@@ -20,6 +20,7 @@
|
|
|
20
20
|
"url": "https://github.com/ORNL-AMO/MEASUR-Tools-Suite/issues"
|
|
21
21
|
},
|
|
22
22
|
"homepage": "https://github.com/ORNL-AMO/MEASUR-Tools-Suite#readme",
|
|
23
|
+
"types": "ts_def/client.d.ts",
|
|
23
24
|
"devDependencies": {
|
|
24
25
|
"chai": "^6.0.1",
|
|
25
26
|
"express": "^4.17.1",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "measur-tools-suite",
|
|
3
|
-
"version": "1.2.1-beta.
|
|
3
|
+
"version": "1.2.1-beta.2",
|
|
4
4
|
"engines": {
|
|
5
5
|
"node": "20.19.4",
|
|
6
6
|
"npm": "10.8.2"
|
|
@@ -20,6 +20,7 @@
|
|
|
20
20
|
"url": "https://github.com/ORNL-AMO/MEASUR-Tools-Suite/issues"
|
|
21
21
|
},
|
|
22
22
|
"homepage": "https://github.com/ORNL-AMO/MEASUR-Tools-Suite#readme",
|
|
23
|
+
"types": "ts_def/client.d.ts",
|
|
23
24
|
"devDependencies": {
|
|
24
25
|
"chai": "^6.0.1",
|
|
25
26
|
"express": "^4.17.1",
|