mazey-taro-utils

Taro helpers for environment detection, navigation, login, scrolling, toasts, page parameters, and device information.

npm install mazey-taro-utils

Public helpers for common Taro tasks

The package delegates platform operations to Taro and keeps application call sites concise.

Environment and device

Read the Taro build environment, window dimensions, operating system, browser class, and screen proportions.

Page and navigation

Read the current page and parameters, or construct Taro navigation and redirect URLs from page names and parameters.

Interaction helpers

Request a login code, show a text toast, and scroll to a page selector through Taro APIs.

Install

Install the package in a Taro project. The package retains @tarojs/taro and mazey as runtime dependencies.

npm install mazey-taro-utils

Usage

Import supported helpers from the package root. Navigation pages are directory names below the Taro /pages route.

import {
  getEnv,
  getWindowSize,
  quickNavigateTo,
  quickToast,
} from "mazey-taro-utils";

quickToast(`Running in ${getEnv() || "an unspecified Taro environment"}`);
quickNavigateTo("profile", { params: { userId: "42" } });

const { width, height } = getWindowSize();
console.log({ width, height });

See the interactive playground for controlled browser demonstrations and the API documentation for the complete public surface.

Website app help

Installation availability depends on the browser and platform. When this browser supplies an installation prompt, the Install app action below becomes available. Other browsers may expose an equivalent action in their own menus.