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.

TianFeng (tf) is WyvernJS’s utility module. It populates window (or any context object you provide) with a broad set of helpers that solve common pain points in vanilla JS projects — from smart DOM querying and hash-based routing to reactive stores, form validation, and device detection.

Initialization

tf.init(context?, options?)
Call tf.init() once at the top of your script to activate TianFeng. By default it writes all helpers directly onto window, so you can call $(), fetchJson(), route, and the rest as bare globals. context defaults to window. Pass tf itself if you’d prefer not to pollute the global scope — every helper will then live under tf.* instead. options is an object where each key maps to a feature group. Omitting a key (or setting it to true) enables that group. Setting a key to false disables it entirely.
Option keyFeature group
selector$() DOM selector
setTasksetTask / clearTask / changeTask
persistpersist localStorage proxy
bodyInWindowbody shorthand
queryquery / urlQuery URL param proxy
validatevalidate.* field validation
conformconform.* input formatting
fetchhelpfetchJson / fetchText / fetchFresh
safeJSONsafeParse
throttlethrottle
devicedevice environment snapshot
treetree() DOM builder
storescreateStore
asyncwait / waitUntil / waitFrame / retry / parallel / sequence
routeroute hash-based router
// Defaults: context = window, all feature groups enabled
tf.init();

// Populate tf itself; skip the body shorthand and routing
tf.init(tf, { bodyInWindow: false, route: false });

Feature Groups

DOM Helpers

Smart $() selector, tree() builder, persist localStorage proxy, and query URL param proxy.

Async & Tasks

setTask, throttle, fetch wrappers, and promise helpers like wait, retry, parallel, and sequence.

State & Routing

createStore deep reactive proxy and route hash-based SPA router with guards and params.

Forms

validate for regex-based field checking and conform for canonical input formatting.

Device Detection

device snapshot covering touch, color scheme, browser, OS, screen, network, battery, and geolocation.

Build docs developers (and LLMs) love