您好,登錄后才能下訂單哦!
var a = function(){
this.eve
this.func
this.on = function(eve,func){
this.eve = eve
this.func = func
}
this.emit = function(eve){
if(this.eve == eve){
var func = this.func
func()
}
}
}
var aa = new a()
aa.on('click',function(){
console.log('im click')
})
aa.emit('click')
b. 輸出:
im click
<?php
class a{
public $eve;
public $func;
public function on($eve,$func){
$this->eve = $eve;
$this->func = $func;
}
public function emit($eve){
if($this.eve == $eve){
$func = $this->func;
$func();
}
}
}
$a = new a();
$a->on('click',function(){
echo "im click";
});
$a->emit('click');
b. 輸出:
im click
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。