# world-trigger

> A small, easy, blazingly fast and scalable state-management solution for react.

Latest version **1.1.1** (published 2024-01-12) · MIT license · 0 weekly downloads

## Install

```sh
npm install world-trigger
pnpm add world-trigger
yarn add world-trigger
bun add world-trigger
```

## Health

**Score 20/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.1.1 |
| Published | 2024-01-12 |
| First published | 2022-08-10 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 6.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | mytabworks |
| Maintainers | mytabworks |
| Keywords | world-trigger, trigger, event listener, dispatcher, reactjs, react-native, react, vue, vuejs, vanilla js, javascript, typescript |

## Links

- npm: https://www.npmjs.com/package/world-trigger
- Repository: https://github.com/mytabworks/world-trigger
- Homepage: https://github.com/mytabworks/world-trigger#readme
- Issues: https://github.com/mytabworks/world-trigger/issues
- npm.io page: https://npm.io/package/world-trigger

## Alternatives

- [mobx-react](https://npm.io/package/mobx-react.md) — 2.8M weekly downloads
- [rc-tree](https://npm.io/package/rc-tree.md) — 2.6M weekly downloads
- [@react-oauth/google](https://npm.io/package/@react-oauth/google.md) — 1.3M weekly downloads
- [@wagmi/connectors](https://npm.io/package/@wagmi/connectors.md) — 877.0K weekly downloads
- [vee-validate](https://npm.io/package/vee-validate.md) — 836.4K weekly downloads

## Recent versions

- 1.1.1 (latest) — 2024-01-12
- 1.1.0 — 2023-12-27
- 1.0.2 — 2022-08-30
- 1.0.1 — 2022-08-10

## README

# World Trigger
This is use for Reactjs, React-Native, Vuejs, and any js framework out there, to trigger or dispatch registered callbacks on any component without using any context.

- [Installation](#installation)
- [How To Use](#how-to-use)
    - [Importing](#imports) 
    - [Basic Usage](#basic-usage)
<br/>

# installation
```
npm i world-trigger
```

or

```
yarn add world-trigger
```
<br/>

# How to use
<br/>

## imports
```js
import worldTrigger from "world-trigger"
```
<br/>

## Basic Usage

```js
import worldTrigger from "world-trigger"

const handleTestTrigger = (data) => {
  console.log(`Yey! ${data.firstname} has trigger me.`)
}
// registered the trigger
worldTrigger.addTrigger('test.trigger', handleTestTrigger)

// unregistered the trigger
worldTrigger.removeTrigger('test.trigger', handleTestTrigger)

// dispatching the trigger with data
worldTrigger.dispatchTrigger('test.trigger', { firstname: 'JR' })

```
<br/><br/>

## Reactjs

```js
import React from "react"
import worldTrigger from "world-trigger"

export const App = () => {
    useEffect(() => {
      const handleTestTrigger = (data) => {
        console.log(`Yey! ${data.firstname} has trigger me.`)
      }

      worldTrigger.addTrigger('test.trigger', handleTestTrigger)

      return () => worldTrigger.removeTrigger('test.trigger', handleTestTrigger)
    }, [])
    
    return ( 
        <ButtonTrigger />
    );
}

const ButtonTrigger = () => { 
    const handleClick = () => {
      worldTrigger.dispatchTrigger('test.trigger', { firstname: 'JR' })
    }

    return (
        <button type="button" onClick={handleClick}>Trigger Me</button>
    );
}
```

## License
MIT Licensed. Copyright (c) Mytabworks 2020.

---
_Source: https://npm.io/package/world-trigger · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
