-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdemo.js
34 lines (23 loc) · 797 Bytes
/
demo.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
const EventEmitter = require('events');
const uuid = require('uuid');
class Logger extends EventEmitter {
log (msg) {
this.emit('message', {id : uuid.v4(), msg})
}
}
const callBack = () => {
console.log('event fired');
}
module.exports = Logger;
// myEmitter.on('evendt', callBack)
// myEmitter.emit('event');
// myEmitter.emit('evendt');
// myEmitter.emit('event');
// const url = require('url');
// const myUrl = new URL('https://samples.openweathermap.org/data/2.5/weather?zip=94040,us&appid=b6907d289e10d714a6e88b30761fae22');
// console.log(myUrl.host);
// console.group(myUrl.toString())
// console.log(myUrl.pathname);
// console.log(myUrl.searchParams);
// const params = [];
// myUrl.searchParams.forEach((value, name) => console.log(`${name}:${value}`));