# onfire-js **Repository Path**: mirrors/onfire-js ## Basic Information - **Project Name**: onfire-js - **Description**: :gun: onfire.js is a nano version (~500b) for event-emitter. - **Primary Language**: Unknown - **License**: MIT - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 1 - **Forks**: 0 - **Created**: 2017-04-03 - **Last Updated**: 2025-12-13 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # onfire.js > nano version (~ 500b) for event-emitter. [![Build Status](https://travis-ci.org/hustcc/onfire.js.svg?branch=master)](https://travis-ci.org/hustcc/onfire.js) [![npm](https://img.shields.io/npm/v/onfire.js.svg)](https://www.npmjs.com/package/onfire.js) [中文文档](./README_zh.md) | [English Doc](./README.md) ## Install > npm i --save onfire.js ## Usage ```js import EE from 'onfire.js'; const ee = new EE(); ee.on('mouseover', () => {}); ee.once('click', () => {}); ee.fire('click', 1, 'hello', true); ee.off('click'); ``` ## API Simple and similar with `event-emitter`. - `on(eventName: string, callback: Function)`: listen an event. - `once(eventName: string, callback: Function)`: listen a event only once. - `fire(eventName: string, ...parameters: any[])`: emit / trigger an event with parameters. - `off(eventName?: string, callback?: Function)`: unsubscribe an event. ## Used - Events subscribe and dispatcher. - `Cross-component communication` for React / Vue / Angular. - System event mechanism. ## License MIT@[hustcc](https://github.com/hustcc).