# spirit-events

> A simple event emitter for the spirit static file generator

Latest version **1.0.0** (published 2014-07-18) · MIT license · 0 weekly downloads

## Install

```sh
npm install spirit-events
pnpm add spirit-events
yarn add spirit-events
bun add spirit-events
```

## Health

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

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.0 |
| Published | 2014-07-18 |
| First published | 2014-07-17 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Alexander James Ray |
| Maintainers | alexray |
| Keywords | spirit, events |

## Links

- npm: https://www.npmjs.com/package/spirit-events
- Repository: http://github.com/alex-ray/spirit-events
- Homepage: https://github.com/alex-ray/spirit-events
- Issues: https://github.com/alex-ray/spirit-events/issues
- npm.io page: https://npm.io/package/spirit-events

## Alternatives

- [async-exit-hook](https://npm.io/package/async-exit-hook.md) — 3.7M weekly downloads
- [evnty](https://npm.io/package/evnty.md) — 7.2K weekly downloads
- [eleventy-plugin-asciidoc](https://npm.io/package/eleventy-plugin-asciidoc.md) — 3.5K weekly downloads
- [@jswork/next-get2get](https://npm.io/package/@jswork/next-get2get.md) — 945 weekly downloads
- [@dashersw/axon](https://npm.io/package/@dashersw/axon.md) — 934 weekly downloads

## Recent versions

- 1.0.0 (latest) — 2014-07-18
- 0.0.1 — 2014-07-17

## README

### Spirit Events

A light weight event emitter for the [ Spirit Core ]( http://github.com/alex-ray/spirit-core) static file generator.

Used to listen, remove and emit events from the spirit object .

#### Usage

install the [ Spirit Core ]( http://github.com/alex-ray/spirit-core ) module.

```
  npm install spirit-core
```

The middleware will expose three `Functions` on the spirit core `Object` .

##### on
Takes two arguments a unique `String` identifier and a 'Function' to call.
The callback will be called every time the unique `String` identifier is emitted.

##### emit
Takes one argument a unique `String` identifier.
Will call every `Function` subscribed to that unique `String` identifier through on.

##### off
Takes one argument a unique `String` identifier, with on optional second `Function`.
If only passed one argument, will remove all callbacks subscribed to the unique `String` identifier.
If a `Function` is passed it will only remove the `Function` subscribed to the unique `String` identifier.

###### Example

```javascript

  var spiritCore = require( 'spirit-core' ) ;

  var someEvent = "SOME_EVENT" ;
  spiritCore.on( someEvent, callback ) ;
  spiritCore.emit( someEvent, "Hello ", "World" ) ;

  function callback ( hello, world ) {
    var helloWorld = hello + world ;
    console.log( helloWorld ) ;
  }

```

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