File tree Expand file tree Collapse file tree 4 files changed +33
-1
lines changed
Expand file tree Collapse file tree 4 files changed +33
-1
lines changed Original file line number Diff line number Diff line change @@ -6,7 +6,7 @@ A small library to detect which features of WebAssembly are supported.
66- ✅ Runs in Node
77- ✅ Provided as an ES6 module, CommonJS and UMD module.
88- ✅ CSP compatible
9- - ✅ Only ~ 504B gzipped
9+ - ✅ Only ~ 580B gzipped
1010
1111## Installation
1212
@@ -45,6 +45,7 @@ All detectors return a `Promise<bool>`.
4545
4646| Function | Proposal |
4747| ----------------------- | ------------------------------------------------------------------------------------------------------------ |
48+ | ` bigInt() ` | [ BigInt integration] ( https://github.com/WebAssembly/JS-BigInt-integration ) |
4849| ` bulkMemory() ` | [ Bulk memory operations] ( https://github.com/webassembly/bulk-memory-operations ) |
4950| ` exceptions() ` | [ Exception handling] ( https://github.com/WebAssembly/exception-handling ) |
5051| ` multiValue() ` | [ Multi-value] ( https://github.com/WebAssembly/multi-value ) |
Original file line number Diff line number Diff line change 1+ /**
2+ * Copyright 2019 Google Inc. All Rights Reserved.
3+ * Licensed under the Apache License, Version 2.0 (the "License");
4+ * you may not use this file except in compliance with the License.
5+ * You may obtain a copy of the License at
6+ * http://www.apache.org/licenses/LICENSE-2.0
7+ * Unless required by applicable law or agreed to in writing, software
8+ * distributed under the License is distributed on an "AS IS" BASIS,
9+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10+ * See the License for the specific language governing permissions and
11+ * limitations under the License.
12+ */
13+
14+ export default async function ( bytes ) {
15+ try {
16+ const n = BigInt ( 0 ) ;
17+ const instance = await WebAssembly . instantiate ( bytes ) ;
18+ return instance . instance . exports . b ( n ) === n ;
19+ } catch {
20+ return false ;
21+ }
22+ }
Original file line number Diff line number Diff line change 1+ ;; Name: BigInt integration
2+ ;; Proposal: https://github.com/WebAssembly/JS-BigInt-integration
3+
4+ (module
5+ (func (export " b" ) (param i64 ) (result i64 )
6+ local.get 0
7+ )
8+ )
Original file line number Diff line number Diff line change @@ -43,6 +43,7 @@ async function run() {
4343 await checkFeature ( "simd" ) ;
4444 await checkFeature ( "tailCall" ) ;
4545 await checkFeature ( "threads" ) ;
46+ await checkFeature ( "bigInt" ) ;
4647}
4748
4849run ( ) ;
You can’t perform that action at this time.
0 commit comments