const e =newEvent();
e.add('sayHello',(err, name)=>{if(err){console.error(err);return}console.log(`hello ${name}`);return})
e.emit('sayHello','发生了错误');
e.emit('sayHello',null,'marron');
链式调用的实现
想使用如下的方式进行调用
const e =newEvent();
e
.add('sayHello',(err, name)=>{if(err){console.error(err);return;}console.log(`hello ${name}`);}).emit('sayHello','发生了错误').emit('sayHello',null,'mar~!');
说明
今天阅读koa源码时,遇到Object.create,感觉对这个概念有点生疏,于是打开了MDN进行重新梳理传送门
Object.create()
直接套用官网的栗子
const person {isHuman: false,printIntroduction: function () {console.log(My name is ${this.name}. Am I human? ${this.i…
传送门 关于excrt 1 //minamoto2 #include<iostream>3 #include<cstdio>4 #define int long long5 using namespace std;6 #define getc() (p1p2&&(p2(p1buf)fread(buf,1,1<<21,stdin),p1p2)?EOF:*p1)7 char buf[1<<21],*p1buf,*p2buf;8 int …
Quit and restart a clean R session from within R? If youre in RStudio: command/ctrl shift F10
.rs.restartR()转载于:https://www.cnblogs.com/shuaihe/p/8945039.html