呼呼。。。前不久参加了一个笔试,里面有一到JS编程题,当时看着题目就蒙圈。。。后来研究了一下,原来就是所谓的观察者模式。就记下来。。。^_^
题目
Event.on('test', 'test', 'test''test', 'hello world'); person1 = person2 ='call1', 'person1''call2', 'person2''call1'); person1.emit('call2'); person2.emit('call1'); person2.emit('call2');
on:
emit:差点没把我看晕...
好吧,一步一步来看看怎么回事。


