随笔分类 - js
摘要:配置 { type: 'custom', data: uds.map((e, i) => [i, ...e.oclh]), encode: { x: 0, y: [1, 2, 3, 4], tooltip: [1, 2, 3, 4], }, renderItem: this.US_Line, } /
阅读全文
摘要:let count = 0, maxCount = 3; function event() { count += 1; console.log(count); return count < maxCount; } let prev = 0; const t = 1000; // 1秒 functio
阅读全文
摘要:枚举本地字体 <button id="btn">Get Local Font</button> document .getElementById("btn") .addEventListener("click", async function () { const pickedFonts = awa
阅读全文
摘要:class UpperCaseTransformStream { constructor() { return new TransformStream({ transform(chunk, controller) { controller.enqueue(chunk.toUpperCase());
阅读全文
摘要:全局配置 local 和 插件,通常在你的入口函数中调用 import dayjs from "dayjs"; import weekday from "dayjs/plugin/weekday"; import "dayjs/locale/zh-cn"; // config dayjs dayjs
阅读全文
摘要:console.log( window.crypto.randomUUID() ) See also: crypto.randomUUID()
阅读全文
摘要:<!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content="text/html;charset=utf-8" /> <link rel="stylesheet" data-name="vs/editor/editor.
阅读全文
摘要:test html <p>title</p> <ul class="list a" id="list"> <li>1</li> <li>2</li> <li>3</li> <li>4</li> </ul> <footer>footer</footer> function xpath(path, pa
阅读全文
摘要:See alsoe: https://www.runoob.com/html/html5-draganddrop.html https://developer.mozilla.org/zh-CN/docs/Web/API/HTML_Drag_and_Drop_API
阅读全文
摘要:let emoji_exp = /(\u00a9|\u00ae|[\u2000-\u3300]|\ud83c[\ud000-\udfff]|\ud83d[\ud000-\udfff]|\ud83e[\ud000-\udfff])/g; function estring(str) { const ms
阅读全文
摘要:class A {} const proxy = new Proxy(new A(), { get(o, k) { if (!/\d+/.test(k.toString())) return o[k]; if (!o.prototype) o.prototype = {}; if (!o.proto
阅读全文
摘要:通常用于google搜索 See also: video 探索搜索库
阅读全文
摘要:在js中与第三方设备的通信 这是一个Xbox One手柄的demo,将手柄使用USB连接到PC上: See also: video Device APIs 通过JavaScript与蓝牙设备通信 在网络上访问USB设备 在Android版Chrome上与NFC设备互动 Serial port 连接到
阅读全文
摘要:let data = { name: "ajanuw", change() { this.name = "Ajanuw"; }, get message() { console.log(this); return "hello " + this.name; }, }; console.log( Ob
阅读全文
摘要:<form action="/verify-otp" method="POST"> <input type="text" inputmode="numeric" autocomplete="one-time-code" pattern="\d{6}" required> </form> naviga
阅读全文
摘要:optimization: { minimizer: [ new TerserJSPlugin({ terserOptions: { format: { comments: /(\s*#if)|(\s*#end)/i, }, }, }), ], }, // #ifdef H5 // #endif
阅读全文
摘要:function myParseInt(str: string): number { let result = NaN; for (let i = 0; i < str.length; i++) { const dec: number = str.charCodeAt(i); if (dec < 4
阅读全文
摘要:<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" /> <title>Docum
阅读全文
摘要:创建webasm字符串模板 my-module.wat: (module (func $add (param $a i32) (param $b i32) (result i32) (i32.add (local.get $a) (local.get $b) ) ) (export "add" (f
阅读全文