a example of extending the event
2016-12-29 本文已影响23人
stone_yao
There are three steps to extending an event emitter.
1.create a class constructor
2.inheriting the event emitter's behavior
3.extending the behavior
example:I create a class called Watcher
that would monitor a directory.If any changes in the directory,Watcher
will rename any files in it to lowercase, and then remove the files into a separate specific directory.
