設計模式:發佈訂閱模式

-- KChris 2017.3.15 (=^.^=)this

發佈訂閱模式,也稱爲觀察者模式。code

1.簡單的例子:server

document.body.addEventListener('click', function () {
    console.log('this is the observer.')
    console.log(1)
} )

2.如今來看看,稍微一點點複雜的例子:io

相關文章
相關標籤/搜索