-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest.html
More file actions
26 lines (25 loc) · 808 Bytes
/
test.html
File metadata and controls
26 lines (25 loc) · 808 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
<!DOCTYPE html>
<html>
<body>
<script src="./node_modules/@deliberative/utils/lib/index.min.js"></script>
<script type="text/javascript">
const onClick = async () => {
try {
const num = 5;
const arr = await dutils.numberToUint8Array(num);
const num1 = await dutils.uint8ArrayToNumber(arr);
console.log(num === num1);
const anotherNum = 0x1020304050607080n;
const anotherArr = dutils.bigIntToUint8Array(anotherNum);
const anotherNum1 = dutils.uint8ArrayToBigInt(anotherArr);
console.log(anotherNum === anotherNum1);
} catch (err) {
console.error(err);
}
};
</script>
<div id="root">
<button onClick="onClick()">Click me</button>
</div>
</body>
</html>