Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/michael-tiger-2010/wyvernjs/llms.txt

Use this file to discover all available pages before exploring further.

WyvernJS supports three install methods — npm for Node.js and bundler environments, ES module CDN imports for modern browsers using native import syntax, and classic <script> tags for zero-setup browser usage with no build step whatsoever. All three methods expose the same dw, tf, fw, and sh globals or named exports, so you can swap between them without changing application code.

Install

Install the package from npm. This gives you access to all four modules through the package’s named exports map.
npm install @mchen_dragon/wyvernjs
After installing, import the full bundle or individual modules by their export path (see Package Exports below).
// Full bundle — all four modules
import { dw, diwu, tf, tianfeng, fw, firewyrm, sh, shuihu } from '@mchen_dragon/wyvernjs';

// Individual modules
import { dw, diwu } from '@mchen_dragon/wyvernjs/diwu';
import { tf, tianfeng } from '@mchen_dragon/wyvernjs/tianfeng';
import { fw, firewyrm } from '@mchen_dragon/wyvernjs/firewyvern';
import { sh, shuihu } from '@mchen_dragon/wyvernjs/shuihu';

Package Exports

When using npm, the exports field in package.json maps the following import paths to their source files:
Import pathFile
@mchen_dragon/wyvernjsmain/wyvern.js (all four modules combined)
@mchen_dragon/wyvernjs/firewyvernmain/firewyvern.js
@mchen_dragon/wyvernjs/shuihumain/shuihu.js
@mchen_dragon/wyvernjs/diwumain/diwu.js
@mchen_dragon/wyvernjs/tianfengmain/tianfeng.js
The package.json main field points to main/wyvern.js, so a bare require('@mchen_dragon/wyvernjs') in CommonJS environments loads the full bundle.

Initialization

Importing or loading WyvernJS does not automatically activate all features. DiWu and TianFeng must be initialized before use. FireWyrm (fw) and ShuiHu (sh) are ready immediately — no init call required.
// Initialize DiWu — extends DOM prototypes with chainable methods
dw.init();
dw.init() accepts an optional params object. Pass false for any key to suppress that prototype addition:
// Disable the .on(), .off(), and .once() event shorthands
dw.init({ on: false, off: false, once: false });

// Force-override an already-existing prototype method (use with care)
dw.init({ css: 'force' });
// Initialize TianFeng — populates a context object with helpers
tf.init();
tf.init(context, options) accepts two optional arguments:
  • context — defaults to window. Pass tf itself (or any plain object) to avoid touching window at all:
    tf.init(tf); // all helpers land on tf instead of window
    // access as: tf.tree(), tf.route, tf.createStore(), etc.
    
  • options — an object of feature flags. Every feature is true by default; set a key to false to disable it:
    tf.init(window, { bodyInWindow: false }); // don't expose `body` on window
    tf.init(window, { route: false });        // skip the hash router
    tf.init(window, { device: false });       // skip device detection object
    
Only browsers have been officially tested. Non-DOM TianFeng features (stores, async helpers, throttle, safeParse, setTask, etc.) and all of FireWyrm are expected to work on ES9+ Node.js, but this has not been formally verified. DiWu is browser-only and should not be initialized in a non-browser environment.

Build docs developers (and LLMs) love