<script>
a=[]
Object.prototype.Push=function(){
length=this.length
setInterval(()=>{
if(this.length > length ){
this.register.Push.map(e=>e())
length=this.length
}
},0)
return this
}
Object.prototype.Pop=function(callback){
length=this.length
setInterval(()=>{
if(this.length < length ){
this.register.Pop.map(e=>e())
length=this.length
}
},0)
return this
}
Object.prototype.on=function(event,callback){
this[event](callback)
}
a.register=[]
a.register.Push=[]
a.register.Pop=[]
a.register.Push.push(()=>console.log(a),()=>console.log('Reactor模式'))
a.register.Pop.push(()=>console.log(a),()=>console.log('Reactor模式'))
a.Push().Pop()
</script>