TianFeng (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.
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() 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 key | Feature group |
|---|---|
selector | $() DOM selector |
setTask | setTask / clearTask / changeTask |
persist | persist localStorage proxy |
bodyInWindow | body shorthand |
query | query / urlQuery URL param proxy |
validate | validate.* field validation |
conform | conform.* input formatting |
fetchhelp | fetchJson / fetchText / fetchFresh |
safeJSON | safeParse |
throttle | throttle |
device | device environment snapshot |
tree | tree() DOM builder |
stores | createStore |
async | wait / waitUntil / waitFrame / retry / parallel / sequence |
route | route hash-based router |
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.