TokenEconomizer
Experience-Driven Black-Box Cost Control for Coding Agents
A package containing a few micro-interactions you can use to reward your users for little things and make them smile!
Developer toolsGitHub @thedevelobearSelf-installOwner unconfirmed
Paste into Claude or ChatGPT for installation instructions suited to your environment.
Have you tried it? One tap is enough. No sign-in needed.
Repository information has not been collected yet.
No updates detected yet. GitHub releases will appear here.
The maker's introduction consists of the line above. Read the repository README for more details. Repository README ↗
Loading the full README.
Read the full README ↗:sparkles: GPU-rendered: WebGL2, with a Canvas 2D fallback
:evergreen_tree: Tree-shakeable: about 7 kB gzipped for useReward and confetti
:female_detective: Built with TypeScript
:stopwatch: Frame-rate independent, and quiet for people who prefer reduced motion
React-rewards lets you add micro-interactions to your app, and rewards users with the rain of confetti, emoji, balloons or fireworks in seconds. Firing confetti all over the page may seem like a questionable idea, but keep in mind that rewarding users for their actions is not. If a huge cloud of smiling emoji doesn't fit your application well, try changing the physics config to make it more subtle.
You can read more on the subject of micro-interactions in my blog post - https://www.thedevelobear.com/post/microinteractions/
thedevelobear.github.io/react-rewards has every effect live, with its settings and the code for what you pick, and the docs:
useReward: its settings, burst options and return valuefire: effects without ReactsetRendererdefineEffectpnpm add react-rewards
# or
npm install react-rewards
# or
yarn add react-rewards
React 18 or later. The package is ESM only.
Give useReward a ref to the element a reward starts from, and an effect. Each call to reward() fires a burst from the centre of that element.
import { useRef } from 'react';
import { confetti, useReward } from 'react-rewards';
export const RewardButton = () => {
const ref = useRef<HTMLButtonElement>(null);
const { reward, isAnimating } = useReward(ref, confetti);
return (
<button ref={ref} type="button" onClick={() => reward()}>
{isAnimating ? 'Yay!' : 'Reward me'}
</button>
);
};
The effects are confetti, emoji, balloon and firework, and each has its settings on its page of the docs.
The repo uses pnpm, and records its decisions in docs/. Start with AGENTS.md for the commands.
MIT