mons-web 0.1.6 → 0.1.7

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/README.md CHANGED
@@ -1,2 +1,6 @@
1
- # mons-web
2
- `npm install mons-web`
1
+ # mons-rust
2
+ `cargo add mons-rust`
3
+
4
+ or
5
+
6
+ `npm install mons-rust`
package/mons_rust.d.ts CHANGED
@@ -12,11 +12,40 @@ export function hello(): string;
12
12
  * @returns {string}
13
13
  */
14
14
  export function winner(fen_w: string, fen_b: string, flat_moves_string_w: string, flat_moves_string_b: string): string;
15
+ /**
16
+ */
17
+ export enum Modifier {
18
+ SelectPotion = 0,
19
+ SelectBomb = 1,
20
+ Cancel = 2,
21
+ }
22
+ /**
23
+ */
24
+ export enum Color {
25
+ White = 0,
26
+ Black = 1,
27
+ }
28
+ /**
29
+ */
30
+ export class Location {
31
+ free(): void;
32
+ /**
33
+ */
34
+ i: number;
35
+ /**
36
+ */
37
+ j: number;
38
+ }
15
39
 
16
40
  export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
17
41
 
18
42
  export interface InitOutput {
19
43
  readonly memory: WebAssembly.Memory;
44
+ readonly __wbg_location_free: (a: number) => void;
45
+ readonly __wbg_get_location_i: (a: number) => number;
46
+ readonly __wbg_set_location_i: (a: number, b: number) => void;
47
+ readonly __wbg_get_location_j: (a: number) => number;
48
+ readonly __wbg_set_location_j: (a: number, b: number) => void;
20
49
  readonly hello: (a: number) => void;
21
50
  readonly winner: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number) => void;
22
51
  readonly __wbindgen_add_to_stack_pointer: (a: number) => number;
package/mons_rust.js CHANGED
@@ -1,14 +1,5 @@
1
1
  let wasm;
2
2
 
3
- let cachedInt32Memory0 = null;
4
-
5
- function getInt32Memory0() {
6
- if (cachedInt32Memory0 === null || cachedInt32Memory0.byteLength === 0) {
7
- cachedInt32Memory0 = new Int32Array(wasm.memory.buffer);
8
- }
9
- return cachedInt32Memory0;
10
- }
11
-
12
3
  const cachedTextDecoder = (typeof TextDecoder !== 'undefined' ? new TextDecoder('utf-8', { ignoreBOM: true, fatal: true }) : { decode: () => { throw Error('TextDecoder not available') } } );
13
4
 
14
5
  if (typeof TextDecoder !== 'undefined') { cachedTextDecoder.decode(); };
@@ -26,6 +17,15 @@ function getStringFromWasm0(ptr, len) {
26
17
  ptr = ptr >>> 0;
27
18
  return cachedTextDecoder.decode(getUint8Memory0().subarray(ptr, ptr + len));
28
19
  }
20
+
21
+ let cachedInt32Memory0 = null;
22
+
23
+ function getInt32Memory0() {
24
+ if (cachedInt32Memory0 === null || cachedInt32Memory0.byteLength === 0) {
25
+ cachedInt32Memory0 = new Int32Array(wasm.memory.buffer);
26
+ }
27
+ return cachedInt32Memory0;
28
+ }
29
29
  /**
30
30
  * @returns {string}
31
31
  */
@@ -133,6 +133,59 @@ export function winner(fen_w, fen_b, flat_moves_string_w, flat_moves_string_b) {
133
133
  }
134
134
  }
135
135
 
136
+ /**
137
+ */
138
+ export const Modifier = Object.freeze({ SelectPotion:0,"0":"SelectPotion",SelectBomb:1,"1":"SelectBomb",Cancel:2,"2":"Cancel", });
139
+ /**
140
+ */
141
+ export const Color = Object.freeze({ White:0,"0":"White",Black:1,"1":"Black", });
142
+
143
+ const LocationFinalization = (typeof FinalizationRegistry === 'undefined')
144
+ ? { register: () => {}, unregister: () => {} }
145
+ : new FinalizationRegistry(ptr => wasm.__wbg_location_free(ptr >>> 0));
146
+ /**
147
+ */
148
+ export class Location {
149
+
150
+ __destroy_into_raw() {
151
+ const ptr = this.__wbg_ptr;
152
+ this.__wbg_ptr = 0;
153
+ LocationFinalization.unregister(this);
154
+ return ptr;
155
+ }
156
+
157
+ free() {
158
+ const ptr = this.__destroy_into_raw();
159
+ wasm.__wbg_location_free(ptr);
160
+ }
161
+ /**
162
+ * @returns {number}
163
+ */
164
+ get i() {
165
+ const ret = wasm.__wbg_get_location_i(this.__wbg_ptr);
166
+ return ret;
167
+ }
168
+ /**
169
+ * @param {number} arg0
170
+ */
171
+ set i(arg0) {
172
+ wasm.__wbg_set_location_i(this.__wbg_ptr, arg0);
173
+ }
174
+ /**
175
+ * @returns {number}
176
+ */
177
+ get j() {
178
+ const ret = wasm.__wbg_get_location_j(this.__wbg_ptr);
179
+ return ret;
180
+ }
181
+ /**
182
+ * @param {number} arg0
183
+ */
184
+ set j(arg0) {
185
+ wasm.__wbg_set_location_j(this.__wbg_ptr, arg0);
186
+ }
187
+ }
188
+
136
189
  async function __wbg_load(module, imports) {
137
190
  if (typeof Response === 'function' && module instanceof Response) {
138
191
  if (typeof WebAssembly.instantiateStreaming === 'function') {
@@ -167,6 +220,9 @@ async function __wbg_load(module, imports) {
167
220
  function __wbg_get_imports() {
168
221
  const imports = {};
169
222
  imports.wbg = {};
223
+ imports.wbg.__wbindgen_throw = function(arg0, arg1) {
224
+ throw new Error(getStringFromWasm0(arg0, arg1));
225
+ };
170
226
 
171
227
  return imports;
172
228
  }
package/mons_rust_bg.wasm CHANGED
Binary file
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "mons-web",
3
3
  "description": "super metal mons",
4
- "version": "0.1.6",
4
+ "version": "0.1.7",
5
5
  "license": "CC0-1.0",
6
6
  "files": [
7
7
  "mons_rust_bg.wasm",