Make an EventEmitter

EventEmitters for AssemblyScript

Installation

~ npm install as-events

Usage

import { EventEmitter } from 'as-events'

const emitter = new EventEmitter<string>()

emitter.on('event', (data) => {

    //...

})

emitter.emit('event', 'Hello Event Emitter!')

This isn't so practical at the moment because you run into issues with closures.

Benchmarks

I ran a few benchmarks and found that as-events is over 2x faster than NodeJS's Events. However, it slowed down at around one million ops/s. 😃

Last updated