webeng14-03-chat

Simple Chat EventEmitter used for Exercise 03.1 of the Web Engineering lecture at the University of Ulm, November 2014.

Usage no npm install needed!

<script type="module">
  import webeng1403Chat from 'https://cdn.skypack.dev/webeng14-03-chat';
</script>

README

Chat Event Emitter

Simple Chat EventEmitter used for Exercise 03.1 of the Web Engineering lecture at the University of Ulm, November 2014.

Installation

npm install webeng14-03-chat

Usage

var Chat = require('./index');
var chat = new Chat();

// listen on 'message' events
chat.on('message', function(message) {
  console.log(message);
});

// enter chat room
//   this will emit a message of the form
//   [Chat] Falco has entered, 3 users at all.
chat.enter('Falco');

// quit chat room
//   this will emit a message of the form
//   [Chat] Falco has left, 2 users at all.

// write a message
chat.write('Falco', 'Hello World!');