NH_base

Base library usable any time.

目前為 2023-10-24 提交的版本,檢視 最新版本

此腳本不應該直接安裝,它是一個供其他腳本使用的函式庫。欲使用本函式庫,請在腳本 metadata 寫上: // @require https://update.cn-greasyfork.org/scripts/477290/1269718/NH_base.js

作者
Mike Castle (Nexus)
版本
13
建立日期
2023-10-12
更新日期
2023-10-24
尺寸
45.3 KB
授權條款
GPL-3.0-or-later

lib/base

Pure JavaScript stuff. Nothing here should be WEB API aware, except Logger's use of console.

Exported properties (as of version 12)

  • version - Bumped per release.
  • NOT_FOUND - Constant (to make eslint's no-magic-numbers setting happy).
  • testing - Object for testing support (to be replaced with TestCase).
  • ensure - Ensures appropriate versions of NexusHoratio libraries are loaded.
  • TestCase - An xUnit style test framework (WIP: https://github.com/nexushoratio/userscripts/issues/172).
  • DefaultMap - Subclass of Map similar to Python's defaultdict.
  • Logger - Fancy-ish log messages (likely over engineered).
  • uuId - Create a UUID-like string with a base.
  • safeId - Normalizes a string to be safe to use as an HTML element id.
  • strHash - Equivalent (for now) of Java's hashCode (do not store externally).
  • Dispatcher - Simple dispatcher (event bus).

More details are in base.js as JSDoc.