This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="ja"> | |
<head> | |
<meta charset="UTF-8"> | |
<title>malloc test</title> | |
<script> | |
fetch("malloc.wasm").then(res => res.arrayBuffer()) | |
.then(buffer => { | |
const binarray = new Uint8Array(buffer); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function() { | |
"use strict"; | |
var pJSDOM = window.pJSDom[window.pJSDom.length - 1]; | |
var pJS = pJSDOM.pJS; | |
var $document = $(document); | |
var spaceCode = " ".charCodeAt(0); | |
var isSpaceKeyPressed = false; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const buffer = new ArrayBuffer(4); | |
const floatView = new Float32Array(buffer); | |
const uint32View = new Uint32Array(buffer); | |
const baseTable = new Uint32Array(512); | |
const shiftTable = new Uint32Array(512); | |
for(let i = 0; i < 256; ++i) { | |
const e = i - 127; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const util = require("util"); | |
const fs = require("fs"); | |
const readdir = util.promisify(fs.readdir); | |
const stat = util.promisify(fs.stat); | |
async function walk(dir, filelist = []) { | |
const files = await readdir(dir); | |
await Promise.all(files.map(async file => { | |
const filename = `${ dir }/${ file }`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* @file Fix https://developer.microsoft.com/en-us/microsoft-edge/platform/issues/106663/ | |
*/ | |
const prototype = IDBObjectStore.prototype; | |
const { add, put, count } = prototype; | |
prototype.add = function(value, key) { | |
return key != null ? add.call(this, value, key) : add.call(this, value); | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
type ImageBlobOptions = ImageBitmapOptions & { type?: string, quality?: number }; | |
export declare function createImageBlob(source: ImageBitmapSource, options?: ImageBlobOptions): Promise<Blob>; | |
export declare function createImageBlob(source: ImageBitmapSource, sx: number, sy: number, sw: number, sh: number, options?: ImageBlobOptions): Promise<Blob>; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* @param {number} byteLength A QuotaExceededError DOMException is thrown if the requested length is greater than 65536 bytes. | |
* @returns {bigint} | |
*/ | |
function getRandomBigIntByByteLength(byteLength) { | |
const buffer = new Uint8Array(byteLength); | |
crypto.getRandomValues(buffer); | |
return buffer.reduce((prev, current) => (prev << 8n) + BigInt(current), 0n); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class StatelessRegExp extends RegExp { | |
* exec(str, index = 0) { | |
let lastIndex = this.lastIndex = index; | |
let match; | |
while ((match = super.exec(str)) !== null) { | |
lastIndex = this.lastIndex; | |
yield match; | |
this.lastIndex = lastIndex; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Node を順に列挙する | |
* | |
* @param {Node} root | |
* @param {?{ whatToShow?: number, filter?: NodeFilter, direction?: "capture" | "bubbling" }} options | |
* @param {"capture" | "bubbling"} options.direction - "capture" では現れる順に列挙し、 "bubbling" では子を持つ Node は子から列挙する | |
* @return {Generator<Node>} | |
*/ | |
function* createNodeIterator(root, options = {}) { | |
const { whatToShow, filter } = options; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** @see https://html.spec.whatwg.org/multipage/syntax.html#void-elements */ | |
const VOID_ELEMENTS = Object.freeze([ | |
"AREA", | |
"BASE", | |
"BR", | |
"COL", | |
"EMBED", | |
"HR", | |
"IMG", | |
"INPUT", |