nodeway-helloworld

nodeway-component helloworld

Usage no npm install needed!

<script type="module">
  import nodewayHelloworld from 'https://cdn.skypack.dev/nodeway-helloworld';
</script>

README

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