| 340 | * ``` |
| 341 | */ |
| 342 | export class WasmGallery { |
| 343 | __destroy_into_raw() { |
| 344 | const ptr = this.__wbg_ptr; |
| 345 | this.__wbg_ptr = 0; |
| 346 | WasmGalleryFinalization.unregister(this); |
| 347 | return ptr; |
| 348 | } |
| 349 | free() { |
| 350 | const ptr = this.__destroy_into_raw(); |
| 351 | wasm.__wbg_wasmgallery_free(ptr, 0); |
| 352 | } |
| 353 | /** |
| 354 | * Add a custom template to the gallery. |
| 355 | * @param {string} template_json |
| 356 | */ |
| 357 | addCustom(template_json) { |
| 358 | try { |
| 359 | const retptr = wasm.__wbindgen_add_to_stack_pointer(-16); |
| 360 | const ptr0 = passStringToWasm0(template_json, wasm.__wbindgen_export, wasm.__wbindgen_export2); |
| 361 | const len0 = WASM_VECTOR_LEN; |
| 362 | wasm.wasmgallery_addCustom(retptr, this.__wbg_ptr, ptr0, len0); |
| 363 | var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true); |
| 364 | var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true); |
| 365 | if (r1) { |
| 366 | throw takeObject(r0); |
| 367 | } |
| 368 | } finally { |
| 369 | wasm.__wbindgen_add_to_stack_pointer(16); |
| 370 | } |
| 371 | } |
| 372 | /** |
| 373 | * Configure the active template with overrides. |
| 374 | * @param {string} config_json |
| 375 | */ |
| 376 | configure(config_json) { |
| 377 | try { |
| 378 | const retptr = wasm.__wbindgen_add_to_stack_pointer(-16); |
| 379 | const ptr0 = passStringToWasm0(config_json, wasm.__wbindgen_export, wasm.__wbindgen_export2); |
| 380 | const len0 = WASM_VECTOR_LEN; |
| 381 | wasm.wasmgallery_configure(retptr, this.__wbg_ptr, ptr0, len0); |
| 382 | var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true); |
| 383 | var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true); |
| 384 | if (r1) { |
| 385 | throw takeObject(r0); |
| 386 | } |
| 387 | } finally { |
| 388 | wasm.__wbindgen_add_to_stack_pointer(16); |
| 389 | } |
| 390 | } |
| 391 | /** |
| 392 | * Get the number of templates in the gallery. |
| 393 | * @returns {number} |
| 394 | */ |
| 395 | count() { |
| 396 | const ret = wasm.wasmgallery_count(this.__wbg_ptr); |
| 397 | return ret >>> 0; |
| 398 | } |
| 399 | /** |
nothing calls this directly
no outgoing calls
no test coverage detected