|
| 1 | +<!-- |
| 2 | +
|
| 3 | +@license Apache-2.0 |
| 4 | +
|
| 5 | +Copyright (c) 2024 The Stdlib Authors. |
| 6 | +
|
| 7 | +Licensed under the Apache License, Version 2.0 (the "License"); |
| 8 | +you may not use this file except in compliance with the License. |
| 9 | +You may obtain a copy of the License at |
| 10 | +
|
| 11 | + http://www.apache.org/licenses/LICENSE-2.0 |
| 12 | +
|
| 13 | +Unless required by applicable law or agreed to in writing, software |
| 14 | +distributed under the License is distributed on an "AS IS" BASIS, |
| 15 | +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 16 | +See the License for the specific language governing permissions and |
| 17 | +limitations under the License. |
| 18 | +
|
| 19 | +--> |
| 20 | + |
| 21 | +# Module |
| 22 | + |
| 23 | +> WebAssembly module wrapper. |
| 24 | +
|
| 25 | +<!-- Section to include introductory text. Make sure to keep an empty line after the intro `section` element and another before the `/section` close. --> |
| 26 | + |
| 27 | +<section class="intro"> |
| 28 | + |
| 29 | +</section> |
| 30 | + |
| 31 | +<!-- /.intro --> |
| 32 | + |
| 33 | +<!-- Package usage documentation. --> |
| 34 | + |
| 35 | +<section class="usage"> |
| 36 | + |
| 37 | +## Usage |
| 38 | + |
| 39 | +```javascript |
| 40 | +var Module = require( '@stdlib/wasm/module-wrapper' ); |
| 41 | +``` |
| 42 | + |
| 43 | +#### Module( binary, memory\[, imports] ) |
| 44 | + |
| 45 | +Returns a new WebAssembly module wrapper instance. |
| 46 | + |
| 47 | +```javascript |
| 48 | +// TO-DO: example |
| 49 | +``` |
| 50 | + |
| 51 | +The function accepts the following arguments: |
| 52 | + |
| 53 | +- **binary**: WebAssembly binary code. |
| 54 | +- **memory**: WebAssembly [memory][@stdlib/wasm/memory] instance. |
| 55 | +- **imports**: WebAssembly module imports object. |
| 56 | + |
| 57 | +* * * |
| 58 | + |
| 59 | +<a name="prop-buffer"></a> |
| 60 | + |
| 61 | +#### Module.prototype.buffer |
| 62 | + |
| 63 | +**Read-only** property which returns a WebAssembly memory buffer as a `Uint8Array`. |
| 64 | + |
| 65 | +```javascript |
| 66 | +// TO-DO: example |
| 67 | +``` |
| 68 | + |
| 69 | +* * * |
| 70 | + |
| 71 | +### Methods |
| 72 | + |
| 73 | +<a name="method-is-view"></a> |
| 74 | + |
| 75 | +#### Module.prototype.isView( arr ) |
| 76 | + |
| 77 | +Returns a boolean indicating whether a provided list of values is a view of the underlying memory of the WebAssembly module. |
| 78 | + |
| 79 | +```javascript |
| 80 | +// TO-DO: example |
| 81 | +``` |
| 82 | + |
| 83 | +</section> |
| 84 | + |
| 85 | +<!-- /.usage --> |
| 86 | + |
| 87 | +* * * |
| 88 | + |
| 89 | +<!-- Package usage notes. Make sure to keep an empty line after the `section` element and another before the `/section` close. --> |
| 90 | + |
| 91 | +<section class="notes"> |
| 92 | + |
| 93 | +</section> |
| 94 | + |
| 95 | +<!-- /.notes --> |
| 96 | + |
| 97 | +<!-- Package usage examples. --> |
| 98 | + |
| 99 | +<section class="examples"> |
| 100 | + |
| 101 | +## Examples |
| 102 | + |
| 103 | +<!-- eslint no-undef: "error" --> |
| 104 | + |
| 105 | +```javascript |
| 106 | +var hasWebAssemblySupport = require( '@stdlib/assert/has-wasm-support' ); |
| 107 | +var Module = require( '@stdlib/wasm/module-wrapper' ); |
| 108 | + |
| 109 | +function main() { |
| 110 | + if ( !hasWebAssemblySupport() ) { |
| 111 | + console.error( 'Environment does not support WebAssembly.' ); |
| 112 | + return; |
| 113 | + } |
| 114 | + console.log( typeof Module ); // TO-DO: write example |
| 115 | +} |
| 116 | + |
| 117 | +main(); |
| 118 | +``` |
| 119 | + |
| 120 | +</section> |
| 121 | + |
| 122 | +<!-- /.examples --> |
| 123 | + |
| 124 | +<!-- Section to include cited references. If references are included, add a horizontal rule *before* the section. Make sure to keep an empty line after the `section` element and another before the `/section` close. --> |
| 125 | + |
| 126 | +<section class="references"> |
| 127 | + |
| 128 | +</section> |
| 129 | + |
| 130 | +<!-- /.references --> |
| 131 | + |
| 132 | +<!-- Section for related `stdlib` packages. Do not manually edit this section, as it is automatically populated. --> |
| 133 | + |
| 134 | +<section class="related"> |
| 135 | + |
| 136 | +</section> |
| 137 | + |
| 138 | +<!-- /.related --> |
| 139 | + |
| 140 | +<!-- Section for all links. Make sure to keep an empty line after the `section` element and another before the `/section` close. --> |
| 141 | + |
| 142 | +<section class="links"> |
| 143 | + |
| 144 | +[@stdlib/wasm/memory]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/wasm/memory |
| 145 | + |
| 146 | +</section> |
| 147 | + |
| 148 | +<!-- /.links --> |
0 commit comments