Events


Directions

  • Create an 'eventing' library out of the Events class.
  • The Events class should have methods 'on', 'trigger', and 'off'.

Solutions

JS

My Solution

class Events {
    constructor() {
        // TODO
    }

    on(eventName, callback) {
        // TODO
    }

    trigger(eventName) {
        // TODO
    }

    off(eventName) {
        // TODO
    }
}

SG Solution

class Events {
    constructor() {
        // TODO
    }

    on(eventName, callback) {
        // TODO
    }

    trigger(eventName) {
        // TODO
    }

    off(eventName) {
        // TODO
    }
}
Made with Gatsby G Logo