ballistics-engine 0.13.3 → 0.13.4
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/LICENSE-APACHE +201 -0
- package/README.md +206 -526
- package/ballistics_engine.d.ts +64 -0
- package/ballistics_engine.js +247 -181
- package/ballistics_engine_bg.wasm +0 -0
- package/package.json +7 -2
package/ballistics_engine.d.ts
CHANGED
|
@@ -47,3 +47,67 @@ export class WasmBallistics {
|
|
|
47
47
|
runCommand(command: string): string;
|
|
48
48
|
constructor();
|
|
49
49
|
}
|
|
50
|
+
|
|
51
|
+
export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
|
|
52
|
+
|
|
53
|
+
export interface InitOutput {
|
|
54
|
+
readonly memory: WebAssembly.Memory;
|
|
55
|
+
readonly __wbg_calculator_free: (a: number, b: number) => void;
|
|
56
|
+
readonly __wbg_wasmballistics_free: (a: number, b: number) => void;
|
|
57
|
+
readonly ballistics_calculate_trajectory: (a: number, b: number, c: number, d: number, e: number) => number;
|
|
58
|
+
readonly ballistics_calculate_zero_angle: (a: number, b: number, c: number, d: number) => number;
|
|
59
|
+
readonly ballistics_free_monte_carlo_results: (a: number) => void;
|
|
60
|
+
readonly ballistics_free_trajectory_result: (a: number) => void;
|
|
61
|
+
readonly ballistics_get_version: () => number;
|
|
62
|
+
readonly ballistics_monte_carlo: (a: number, b: number, c: number) => number;
|
|
63
|
+
readonly ballistics_quick_trajectory: (a: number, b: number, c: number, d: number, e: number) => number;
|
|
64
|
+
readonly calculator_calculateTrajectory: (a: number, b: number) => [number, number, number];
|
|
65
|
+
readonly calculator_enableCoriolis: (a: number, b: number, c: number, d: number) => number;
|
|
66
|
+
readonly calculator_enableSpinDrift: (a: number, b: number, c: number, d: number) => number;
|
|
67
|
+
readonly calculator_getFullTrajectory: (a: number) => [number, number, number];
|
|
68
|
+
readonly calculator_new: () => number;
|
|
69
|
+
readonly calculator_setAltitude: (a: number, b: number) => number;
|
|
70
|
+
readonly calculator_setBC: (a: number, b: number) => number;
|
|
71
|
+
readonly calculator_setDiameter: (a: number, b: number) => number;
|
|
72
|
+
readonly calculator_setDragModel: (a: number, b: number, c: number) => number;
|
|
73
|
+
readonly calculator_setHumidity: (a: number, b: number) => number;
|
|
74
|
+
readonly calculator_setMass: (a: number, b: number) => number;
|
|
75
|
+
readonly calculator_setMaxRange: (a: number, b: number) => number;
|
|
76
|
+
readonly calculator_setPressure: (a: number, b: number) => number;
|
|
77
|
+
readonly calculator_setSightHeight: (a: number, b: number) => number;
|
|
78
|
+
readonly calculator_setTemperature: (a: number, b: number) => number;
|
|
79
|
+
readonly calculator_setVelocity: (a: number, b: number) => number;
|
|
80
|
+
readonly calculator_setWind: (a: number, b: number, c: number) => number;
|
|
81
|
+
readonly calculator_setZeroRange: (a: number, b: number) => number;
|
|
82
|
+
readonly wasmballistics_runCommand: (a: number, b: number, c: number) => [number, number, number, number];
|
|
83
|
+
readonly wasmballistics_new: () => number;
|
|
84
|
+
readonly __wbindgen_exn_store: (a: number) => void;
|
|
85
|
+
readonly __externref_table_alloc: () => number;
|
|
86
|
+
readonly __wbindgen_externrefs: WebAssembly.Table;
|
|
87
|
+
readonly __wbindgen_malloc: (a: number, b: number) => number;
|
|
88
|
+
readonly __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
|
|
89
|
+
readonly __externref_table_dealloc: (a: number) => void;
|
|
90
|
+
readonly __wbindgen_free: (a: number, b: number, c: number) => void;
|
|
91
|
+
readonly __wbindgen_start: () => void;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
export type SyncInitInput = BufferSource | WebAssembly.Module;
|
|
95
|
+
/**
|
|
96
|
+
* Instantiates the given `module`, which can either be bytes or
|
|
97
|
+
* a precompiled `WebAssembly.Module`.
|
|
98
|
+
*
|
|
99
|
+
* @param {{ module: SyncInitInput }} module - Passing `SyncInitInput` directly is deprecated.
|
|
100
|
+
*
|
|
101
|
+
* @returns {InitOutput}
|
|
102
|
+
*/
|
|
103
|
+
export function initSync(module: { module: SyncInitInput } | SyncInitInput): InitOutput;
|
|
104
|
+
|
|
105
|
+
/**
|
|
106
|
+
* If `module_or_path` is {RequestInfo} or {URL}, makes a request and
|
|
107
|
+
* for everything else, calls `WebAssembly.instantiate` directly.
|
|
108
|
+
*
|
|
109
|
+
* @param {{ module_or_path: InitInput | Promise<InitInput> }} module_or_path - Passing `InitInput` directly is deprecated.
|
|
110
|
+
*
|
|
111
|
+
* @returns {Promise<InitOutput>}
|
|
112
|
+
*/
|
|
113
|
+
export default function __wbg_init (module_or_path?: { module_or_path: InitInput | Promise<InitInput> } | InitInput | Promise<InitInput>): Promise<InitOutput>;
|
package/ballistics_engine.js
CHANGED
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
let imports = {};
|
|
3
|
-
imports['__wbindgen_placeholder__'] = module.exports;
|
|
1
|
+
let wasm;
|
|
4
2
|
|
|
5
3
|
let cachedUint8ArrayMemory0 = null;
|
|
6
4
|
|
|
@@ -15,7 +13,15 @@ let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true
|
|
|
15
13
|
|
|
16
14
|
cachedTextDecoder.decode();
|
|
17
15
|
|
|
16
|
+
const MAX_SAFARI_DECODE_BYTES = 2146435072;
|
|
17
|
+
let numBytesDecoded = 0;
|
|
18
18
|
function decodeText(ptr, len) {
|
|
19
|
+
numBytesDecoded += len;
|
|
20
|
+
if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) {
|
|
21
|
+
cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
|
22
|
+
cachedTextDecoder.decode();
|
|
23
|
+
numBytesDecoded = len;
|
|
24
|
+
}
|
|
19
25
|
return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
|
|
20
26
|
}
|
|
21
27
|
|
|
@@ -115,7 +121,7 @@ const CalculatorFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
|
115
121
|
* Object-oriented calculator for programmatic use
|
|
116
122
|
* Provides a type-safe, fluent API alternative to the CLI interface
|
|
117
123
|
*/
|
|
118
|
-
class Calculator {
|
|
124
|
+
export class Calculator {
|
|
119
125
|
|
|
120
126
|
static __wrap(ptr) {
|
|
121
127
|
ptr = ptr >>> 0;
|
|
@@ -314,13 +320,11 @@ class Calculator {
|
|
|
314
320
|
}
|
|
315
321
|
if (Symbol.dispose) Calculator.prototype[Symbol.dispose] = Calculator.prototype.free;
|
|
316
322
|
|
|
317
|
-
exports.Calculator = Calculator;
|
|
318
|
-
|
|
319
323
|
const WasmBallisticsFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
320
324
|
? { register: () => {}, unregister: () => {} }
|
|
321
325
|
: new FinalizationRegistry(ptr => wasm.__wbg_wasmballistics_free(ptr >>> 0, 1));
|
|
322
326
|
|
|
323
|
-
class WasmBallistics {
|
|
327
|
+
export class WasmBallistics {
|
|
324
328
|
|
|
325
329
|
__destroy_into_raw() {
|
|
326
330
|
const ptr = this.__wbg_ptr;
|
|
@@ -367,178 +371,240 @@ class WasmBallistics {
|
|
|
367
371
|
}
|
|
368
372
|
if (Symbol.dispose) WasmBallistics.prototype[Symbol.dispose] = WasmBallistics.prototype.free;
|
|
369
373
|
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
}
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
};
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
return
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
};
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
};
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
};
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
}
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
};
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
374
|
+
const EXPECTED_RESPONSE_TYPES = new Set(['basic', 'cors', 'default']);
|
|
375
|
+
|
|
376
|
+
async function __wbg_load(module, imports) {
|
|
377
|
+
if (typeof Response === 'function' && module instanceof Response) {
|
|
378
|
+
if (typeof WebAssembly.instantiateStreaming === 'function') {
|
|
379
|
+
try {
|
|
380
|
+
return await WebAssembly.instantiateStreaming(module, imports);
|
|
381
|
+
|
|
382
|
+
} catch (e) {
|
|
383
|
+
const validResponse = module.ok && EXPECTED_RESPONSE_TYPES.has(module.type);
|
|
384
|
+
|
|
385
|
+
if (validResponse && module.headers.get('Content-Type') !== 'application/wasm') {
|
|
386
|
+
console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve Wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n", e);
|
|
387
|
+
|
|
388
|
+
} else {
|
|
389
|
+
throw e;
|
|
390
|
+
}
|
|
391
|
+
}
|
|
392
|
+
}
|
|
393
|
+
|
|
394
|
+
const bytes = await module.arrayBuffer();
|
|
395
|
+
return await WebAssembly.instantiate(bytes, imports);
|
|
396
|
+
|
|
397
|
+
} else {
|
|
398
|
+
const instance = await WebAssembly.instantiate(module, imports);
|
|
399
|
+
|
|
400
|
+
if (instance instanceof WebAssembly.Instance) {
|
|
401
|
+
return { instance, module };
|
|
402
|
+
|
|
403
|
+
} else {
|
|
404
|
+
return instance;
|
|
405
|
+
}
|
|
406
|
+
}
|
|
407
|
+
}
|
|
408
|
+
|
|
409
|
+
function __wbg_get_imports() {
|
|
410
|
+
const imports = {};
|
|
411
|
+
imports.wbg = {};
|
|
412
|
+
imports.wbg.__wbg___wbindgen_is_function_ee8a6c5833c90377 = function(arg0) {
|
|
413
|
+
const ret = typeof(arg0) === 'function';
|
|
414
|
+
return ret;
|
|
415
|
+
};
|
|
416
|
+
imports.wbg.__wbg___wbindgen_is_object_c818261d21f283a4 = function(arg0) {
|
|
417
|
+
const val = arg0;
|
|
418
|
+
const ret = typeof(val) === 'object' && val !== null;
|
|
419
|
+
return ret;
|
|
420
|
+
};
|
|
421
|
+
imports.wbg.__wbg___wbindgen_is_string_fbb76cb2940daafd = function(arg0) {
|
|
422
|
+
const ret = typeof(arg0) === 'string';
|
|
423
|
+
return ret;
|
|
424
|
+
};
|
|
425
|
+
imports.wbg.__wbg___wbindgen_is_undefined_2d472862bd29a478 = function(arg0) {
|
|
426
|
+
const ret = arg0 === undefined;
|
|
427
|
+
return ret;
|
|
428
|
+
};
|
|
429
|
+
imports.wbg.__wbg___wbindgen_throw_b855445ff6a94295 = function(arg0, arg1) {
|
|
430
|
+
throw new Error(getStringFromWasm0(arg0, arg1));
|
|
431
|
+
};
|
|
432
|
+
imports.wbg.__wbg_call_525440f72fbfc0ea = function() { return handleError(function (arg0, arg1, arg2) {
|
|
433
|
+
const ret = arg0.call(arg1, arg2);
|
|
434
|
+
return ret;
|
|
435
|
+
}, arguments) };
|
|
436
|
+
imports.wbg.__wbg_call_e762c39fa8ea36bf = function() { return handleError(function (arg0, arg1) {
|
|
437
|
+
const ret = arg0.call(arg1);
|
|
438
|
+
return ret;
|
|
439
|
+
}, arguments) };
|
|
440
|
+
imports.wbg.__wbg_crypto_574e78ad8b13b65f = function(arg0) {
|
|
441
|
+
const ret = arg0.crypto;
|
|
442
|
+
return ret;
|
|
443
|
+
};
|
|
444
|
+
imports.wbg.__wbg_getRandomValues_b8f5dbd5f3995a9e = function() { return handleError(function (arg0, arg1) {
|
|
445
|
+
arg0.getRandomValues(arg1);
|
|
446
|
+
}, arguments) };
|
|
447
|
+
imports.wbg.__wbg_length_69bca3cb64fc8748 = function(arg0) {
|
|
448
|
+
const ret = arg0.length;
|
|
449
|
+
return ret;
|
|
450
|
+
};
|
|
451
|
+
imports.wbg.__wbg_msCrypto_a61aeb35a24c1329 = function(arg0) {
|
|
452
|
+
const ret = arg0.msCrypto;
|
|
453
|
+
return ret;
|
|
454
|
+
};
|
|
455
|
+
imports.wbg.__wbg_new_1acc0b6eea89d040 = function() {
|
|
456
|
+
const ret = new Object();
|
|
457
|
+
return ret;
|
|
458
|
+
};
|
|
459
|
+
imports.wbg.__wbg_new_e17d9f43105b08be = function() {
|
|
460
|
+
const ret = new Array();
|
|
461
|
+
return ret;
|
|
462
|
+
};
|
|
463
|
+
imports.wbg.__wbg_new_no_args_ee98eee5275000a4 = function(arg0, arg1) {
|
|
464
|
+
const ret = new Function(getStringFromWasm0(arg0, arg1));
|
|
465
|
+
return ret;
|
|
466
|
+
};
|
|
467
|
+
imports.wbg.__wbg_new_with_length_01aa0dc35aa13543 = function(arg0) {
|
|
468
|
+
const ret = new Uint8Array(arg0 >>> 0);
|
|
469
|
+
return ret;
|
|
470
|
+
};
|
|
471
|
+
imports.wbg.__wbg_node_905d3e251edff8a2 = function(arg0) {
|
|
472
|
+
const ret = arg0.node;
|
|
473
|
+
return ret;
|
|
474
|
+
};
|
|
475
|
+
imports.wbg.__wbg_process_dc0fbacc7c1c06f7 = function(arg0) {
|
|
476
|
+
const ret = arg0.process;
|
|
477
|
+
return ret;
|
|
478
|
+
};
|
|
479
|
+
imports.wbg.__wbg_prototypesetcall_2a6620b6922694b2 = function(arg0, arg1, arg2) {
|
|
480
|
+
Uint8Array.prototype.set.call(getArrayU8FromWasm0(arg0, arg1), arg2);
|
|
481
|
+
};
|
|
482
|
+
imports.wbg.__wbg_push_df81a39d04db858c = function(arg0, arg1) {
|
|
483
|
+
const ret = arg0.push(arg1);
|
|
484
|
+
return ret;
|
|
485
|
+
};
|
|
486
|
+
imports.wbg.__wbg_randomFillSync_ac0988aba3254290 = function() { return handleError(function (arg0, arg1) {
|
|
487
|
+
arg0.randomFillSync(arg1);
|
|
488
|
+
}, arguments) };
|
|
489
|
+
imports.wbg.__wbg_require_60cc747a6bc5215a = function() { return handleError(function () {
|
|
490
|
+
const ret = module.require;
|
|
491
|
+
return ret;
|
|
492
|
+
}, arguments) };
|
|
493
|
+
imports.wbg.__wbg_set_c2abbebe8b9ebee1 = function() { return handleError(function (arg0, arg1, arg2) {
|
|
494
|
+
const ret = Reflect.set(arg0, arg1, arg2);
|
|
495
|
+
return ret;
|
|
496
|
+
}, arguments) };
|
|
497
|
+
imports.wbg.__wbg_static_accessor_GLOBAL_89e1d9ac6a1b250e = function() {
|
|
498
|
+
const ret = typeof global === 'undefined' ? null : global;
|
|
499
|
+
return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
|
|
500
|
+
};
|
|
501
|
+
imports.wbg.__wbg_static_accessor_GLOBAL_THIS_8b530f326a9e48ac = function() {
|
|
502
|
+
const ret = typeof globalThis === 'undefined' ? null : globalThis;
|
|
503
|
+
return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
|
|
504
|
+
};
|
|
505
|
+
imports.wbg.__wbg_static_accessor_SELF_6fdf4b64710cc91b = function() {
|
|
506
|
+
const ret = typeof self === 'undefined' ? null : self;
|
|
507
|
+
return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
|
|
508
|
+
};
|
|
509
|
+
imports.wbg.__wbg_static_accessor_WINDOW_b45bfc5a37f6cfa2 = function() {
|
|
510
|
+
const ret = typeof window === 'undefined' ? null : window;
|
|
511
|
+
return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
|
|
512
|
+
};
|
|
513
|
+
imports.wbg.__wbg_subarray_480600f3d6a9f26c = function(arg0, arg1, arg2) {
|
|
514
|
+
const ret = arg0.subarray(arg1 >>> 0, arg2 >>> 0);
|
|
515
|
+
return ret;
|
|
516
|
+
};
|
|
517
|
+
imports.wbg.__wbg_versions_c01dfd4722a88165 = function(arg0) {
|
|
518
|
+
const ret = arg0.versions;
|
|
519
|
+
return ret;
|
|
520
|
+
};
|
|
521
|
+
imports.wbg.__wbindgen_cast_2241b6af4c4b2941 = function(arg0, arg1) {
|
|
522
|
+
// Cast intrinsic for `Ref(String) -> Externref`.
|
|
523
|
+
const ret = getStringFromWasm0(arg0, arg1);
|
|
524
|
+
return ret;
|
|
525
|
+
};
|
|
526
|
+
imports.wbg.__wbindgen_cast_cb9088102bce6b30 = function(arg0, arg1) {
|
|
527
|
+
// Cast intrinsic for `Ref(Slice(U8)) -> NamedExternref("Uint8Array")`.
|
|
528
|
+
const ret = getArrayU8FromWasm0(arg0, arg1);
|
|
529
|
+
return ret;
|
|
530
|
+
};
|
|
531
|
+
imports.wbg.__wbindgen_cast_d6cd19b81560fd6e = function(arg0) {
|
|
532
|
+
// Cast intrinsic for `F64 -> Externref`.
|
|
533
|
+
const ret = arg0;
|
|
534
|
+
return ret;
|
|
535
|
+
};
|
|
536
|
+
imports.wbg.__wbindgen_init_externref_table = function() {
|
|
537
|
+
const table = wasm.__wbindgen_externrefs;
|
|
538
|
+
const offset = table.grow(4);
|
|
539
|
+
table.set(0, undefined);
|
|
540
|
+
table.set(offset + 0, undefined);
|
|
541
|
+
table.set(offset + 1, null);
|
|
542
|
+
table.set(offset + 2, true);
|
|
543
|
+
table.set(offset + 3, false);
|
|
544
|
+
;
|
|
545
|
+
};
|
|
546
|
+
|
|
547
|
+
return imports;
|
|
548
|
+
}
|
|
549
|
+
|
|
550
|
+
function __wbg_finalize_init(instance, module) {
|
|
551
|
+
wasm = instance.exports;
|
|
552
|
+
__wbg_init.__wbindgen_wasm_module = module;
|
|
553
|
+
cachedUint8ArrayMemory0 = null;
|
|
554
|
+
|
|
555
|
+
|
|
556
|
+
wasm.__wbindgen_start();
|
|
557
|
+
return wasm;
|
|
558
|
+
}
|
|
559
|
+
|
|
560
|
+
function initSync(module) {
|
|
561
|
+
if (wasm !== undefined) return wasm;
|
|
562
|
+
|
|
563
|
+
|
|
564
|
+
if (typeof module !== 'undefined') {
|
|
565
|
+
if (Object.getPrototypeOf(module) === Object.prototype) {
|
|
566
|
+
({module} = module)
|
|
567
|
+
} else {
|
|
568
|
+
console.warn('using deprecated parameters for `initSync()`; pass a single object instead')
|
|
569
|
+
}
|
|
570
|
+
}
|
|
571
|
+
|
|
572
|
+
const imports = __wbg_get_imports();
|
|
573
|
+
|
|
574
|
+
if (!(module instanceof WebAssembly.Module)) {
|
|
575
|
+
module = new WebAssembly.Module(module);
|
|
576
|
+
}
|
|
577
|
+
|
|
578
|
+
const instance = new WebAssembly.Instance(module, imports);
|
|
579
|
+
|
|
580
|
+
return __wbg_finalize_init(instance, module);
|
|
581
|
+
}
|
|
582
|
+
|
|
583
|
+
async function __wbg_init(module_or_path) {
|
|
584
|
+
if (wasm !== undefined) return wasm;
|
|
585
|
+
|
|
586
|
+
|
|
587
|
+
if (typeof module_or_path !== 'undefined') {
|
|
588
|
+
if (Object.getPrototypeOf(module_or_path) === Object.prototype) {
|
|
589
|
+
({module_or_path} = module_or_path)
|
|
590
|
+
} else {
|
|
591
|
+
console.warn('using deprecated parameters for the initialization function; pass a single object instead')
|
|
592
|
+
}
|
|
593
|
+
}
|
|
594
|
+
|
|
595
|
+
if (typeof module_or_path === 'undefined') {
|
|
596
|
+
module_or_path = new URL('ballistics_engine_bg.wasm', import.meta.url);
|
|
597
|
+
}
|
|
598
|
+
const imports = __wbg_get_imports();
|
|
599
|
+
|
|
600
|
+
if (typeof module_or_path === 'string' || (typeof Request === 'function' && module_or_path instanceof Request) || (typeof URL === 'function' && module_or_path instanceof URL)) {
|
|
601
|
+
module_or_path = fetch(module_or_path);
|
|
602
|
+
}
|
|
603
|
+
|
|
604
|
+
const { instance, module } = await __wbg_load(await module_or_path, imports);
|
|
605
|
+
|
|
606
|
+
return __wbg_finalize_init(instance, module);
|
|
607
|
+
}
|
|
544
608
|
|
|
609
|
+
export { initSync };
|
|
610
|
+
export default __wbg_init;
|
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ballistics-engine",
|
|
3
|
+
"type": "module",
|
|
3
4
|
"collaborators": [
|
|
4
5
|
"Alex Jokela <email@tinycomputers.io>"
|
|
5
6
|
],
|
|
6
7
|
"description": "High-performance ballistics trajectory engine with professional physics",
|
|
7
|
-
"version": "0.13.
|
|
8
|
+
"version": "0.13.4",
|
|
8
9
|
"license": "MIT OR Apache-2.0",
|
|
9
10
|
"repository": {
|
|
10
11
|
"type": "git",
|
|
@@ -13,11 +14,15 @@
|
|
|
13
14
|
"files": [
|
|
14
15
|
"ballistics_engine_bg.wasm",
|
|
15
16
|
"ballistics_engine.js",
|
|
16
|
-
"ballistics_engine.d.ts"
|
|
17
|
+
"ballistics_engine.d.ts",
|
|
18
|
+
"LICENSE-APACHE"
|
|
17
19
|
],
|
|
18
20
|
"main": "ballistics_engine.js",
|
|
19
21
|
"homepage": "https://ballistics.rs/",
|
|
20
22
|
"types": "ballistics_engine.d.ts",
|
|
23
|
+
"sideEffects": [
|
|
24
|
+
"./snippets/*"
|
|
25
|
+
],
|
|
21
26
|
"keywords": [
|
|
22
27
|
"ballistics",
|
|
23
28
|
"trajectory",
|