flint / Lurker

Resource Tracking
http://lurker.rtfd.org
MIT License
179 stars 24 forks source link

Add ResourceWatcherEvent #8

Closed romainneutron closed 8 years ago

romainneutron commented 10 years ago

Hey,

this PR adds ResourceWatcherEvent providing three events type to interact with the ResourceWatcher itself. It can be very convenient in some case to know when a period has been finished.

For example, if listening to the events in a directory :

With the current implementation, if nothing changes in the directory, there are no events. We have to run ResourceWatcher::start with a time limit , then process files, then re-run etc...

With this PR, this kind of usecase is doable out of the box.

henrikbjorn commented 10 years ago

I like this idea. But i have some comments.

Normally the convention is to have a events class, like Lurker\LurkerEvents that have the constants and then a specific Lurker\Event\ResourceWatcherEvent class.

Instead of going through the getEventDispatcher method i think it would be better to use the property directly.

Looks like the test are not aware of the new events.

henrikbjorn commented 9 years ago

@romainneutron i really want to merge this, but can you have a look at the failing testcase?