nodeway-helloworld

2.0.0 • Public • Published

nodeway-helloworld

class HelloWorld extends Nodeway {
    on(eventName, fn) { ... }              // Nodeway中定义
    emit(eventName, ...args) { ... }       // Nodeway中定义
    static get onlineUsers() { ... }       // Nodeway中定义
    static get onlineCount() { ... }       // Nodeway中定义
    broadcast(eventName, ...args) { ... }  // Nodeway中定义
    async say(message) { ... }
}
 
module.exports = HelloWorld;

on()

var api = new HelloWorld;
api.on('data', console.log);

emit()

api.emit('data', 'Hello World!');

static get onlineUsers()

let onlineUsers = HelloWorld.onlineUsers;

static get onlineCount()

let onlineCount = HelloWorld.onlineCount;

broadcast()

api.broadcast('data', 'Hello World!');

say()

try {
    let message = await api.say('Hello Nodejs!');
    console.log(message);
}
catch(e) {}

License

MIT © May xiaoya zhang

Package Sidebar

Install

npm i nodeway-helloworld

Weekly Downloads

1

Version

2.0.0

License

MIT

Unpacked Size

3.54 kB

Total Files

8

Last publish

Collaborators

  • may