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