This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// based on different implementations from this thread https://gist.github.com/mudge/5830382 | |
export type Listener = (...args: any[]) => void; | |
export type Events = Record<string, Set<Listener>>; | |
class EventEmitter { | |
private events: Events = {}; | |
on(event: string, listener: Listener) { | |
if (typeof this.events[event] !== "object") { | |
this.events[event] = new Set(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pragma solidity ^0.4.17; | |
contract Inbox { | |
string public message; | |
function Inbox(string initialMessage) public { | |
message = initialMessage; | |
} | |
function setMessage(string newMessage) public { |