← All posts

API & helpers

window.JZ as a mini-framework — your own tool panel from actions

A single action is a button and some code. But actions can call each other — and from that moment you hold a small framework. window.JZ lets you build complex, multi-step workflows out of buttons.

What window.JZ is

In the code of any rule or action, the window.JZ object is available — an API to drive the JustZix action bar:

The lookup ignores case: JZ.click('save') equals JZ.click('SAVE').

Pattern 1 — an orchestrator action

Three actions each do one thing, a fourth composes them into a sequence:

// Action "AUTO" — runs three others in order
JZ.click('LOAD');
setTimeout(() => JZ.click('PROC'), 500);
setTimeout(() => JZ.click('SAVE'), 1500);

You test each of the three component actions on its own; "AUTO" only conducts them. It is the same principle as functions calling functions.

Pattern 2 — a conditional action

// Action "SMART" — behavior depends on page state
if (document.querySelector('.logged-in')) {
  JZ.click('EXPORT');
} else {
  JZ.click('LOGIN');
}

Pattern 3 — a loop over actions

JZ.actions() and JZ.labels() let you treat the bar as data:

// Action "ALL" — fires every action whose label starts with "T"
JZ.labels()
  .filter(l => l.startsWith('T'))
  .forEach(l => JZ.click(l));

Why this works like a framework

You have units (actions), a way to invoke them (JZ.click), introspection (JZ.actions/labels) and composition (an action calling actions). That is enough to build a multi-step tool out of a button bar — with no external library.

Pitfalls

See also

Install JustZix — and build something bigger than a button out of buttons.

Rate this post

No ratings yet — be the first.

Try it yourself

Install JustZix and paste any snippet from this article. Two minutes from zero to a working rule across all your devices.

Get JustZix

Features · How it works · Examples · Use cases