CDEvents Class Reference
| Inherits from | NSObject | 
| Conforms to | NSCopying | 
| Declared in | CDEvents.h | 
Overview
An Objective-C wrapper for the FSEvents C API.
Note: Inpired by SCEvents class of the SCEvents project by Stuart Connolly.
Tasks
Managing the Delegate
- 
	
		
delegateThe delegate object the
propertyCDEventsobject calls when it recieves an event. 
Getting Event Block
- 
	
		
eventBlockThe event block.
property 
Getting Event Watcher Properties
- 
	
		
notificationLatencyThe (approximate) time intervall between notifications sent to the delegate.
property - 
	
		
sinceEventIdentifierThe event identifier from which events will be supplied to the delegate.
property - 
	
		
lastEventThe last event that occured and has been delivered to the delegate.
property - 
	
		
watchedURLsThe URLs that we watch for events.
property 
Configuring the Event watcher
- 
	
		
excludedURLsThe URLs that we should ignore events from.
property - 
	
		
ignoreEventsFromSubDirectoriesWheter events from sub-directories of the watched URLs should be ignored or not.
property 
Current Event Identifier
- 
	
		
+ currentEventIdentifierThe current event identifier.
 
Creating CDEvents Objects With a Delegate
- 
	
		
– initWithURLs:delegate:Returns an
CDEventsobject initialized with the given URLs to watch. - 
	
		
– initWithURLs:delegate:onRunLoop:Returns an
CDEventsobject initialized with the given URLs to watch and schedules the watcher on the given run loop. - 
	
		
– initWithURLs:delegate:onRunLoop:sinceEventIdentifier:notificationLantency:ignoreEventsFromSubDirs:excludeURLs:streamCreationFlags:Returns an
CDEventsobject initialized with the given URLs to watch, URLs to exclude, wheter events from sub-directories are ignored or not and schedules the watcher on the given run loop. 
Creating CDEvents Objects With a Block
- 
	
		
– initWithURLs:block:Returns an
CDEventsobject initialized with the given URLs to watch. - 
	
		
– initWithURLs:block:onRunLoop:Returns an
CDEventsobject initialized with the given URLs to watch and schedules the watcher on the given run loop. - 
	
		
– initWithURLs:block:onRunLoop:sinceEventIdentifier:notificationLantency:ignoreEventsFromSubDirs:excludeURLs:streamCreationFlags:Returns an
CDEventsobject initialized with the given URLs to watch, URLs to exclude, wheter events from sub-directories are ignored or not and schedules the watcher on the given run loop. 
Flushing Events
- 
	
		
– flushSynchronouslyFlushes the event stream synchronously.
 - 
	
		
– flushAsynchronouslyFlushes the event stream asynchronously.
 
Events Description
- 
	
		
– streamDescriptionReturns a NSString containing the description of the current event stream.
 
Properties
delegate
The delegate object the CDEvents object calls when it recieves an event.
@property (unsafe_unretained) id<CDEventsDelegate> delegateParameters
- delegate
 Delegate for the events object.
nilremoves the delegate.
Return Value
The events’s delegate.
Availability
1.0.0
Discussion
The delegate object the CDEvents object calls when it recieves an event.
See Also
Declared In
CDEvents.heventBlock
The event block.
@property (readonly) CDEventsEventBlock eventBlockReturn Value
The CDEventsEventBlock block which is executed when an event occurs.
Availability
head
Discussion
The event block.
Declared In
CDEvents.hexcludedURLs
The URLs that we should ignore events from.
@property (copy) NSArray *excludedURLsReturn Value
An array of NSURL object for the URLs which we want to ignore.
@discussion Events from concerning these URLs and there sub-directories will not be delivered to the delegate.
Availability
1.0.0
Discussion
The URLs that we should ignore events from.
Declared In
CDEvents.hignoreEventsFromSubDirectories
Wheter events from sub-directories of the watched URLs should be ignored or not.
@property (assign) BOOL ignoreEventsFromSubDirectoriesParameters
- flag
 Wheter events from sub-directories of the watched URLs shouled be ignored or not.
Return Value
YES if events from sub-directories should be ignored, otherwise NO.
Availability
1.0.0
Discussion
Wheter events from sub-directories of the watched URLs should be ignored or not.
Declared In
CDEvents.hlastEvent
The last event that occured and has been delivered to the delegate.
@property (strong, readonly) CDEvent *lastEventReturn Value
The last event that occured and has been delivered to the delegate.
Availability
1.0.0
Discussion
The last event that occured and has been delivered to the delegate.
Declared In
CDEvents.hnotificationLatency
The (approximate) time intervall between notifications sent to the delegate.
@property (readonly) CFTimeInterval notificationLatencyReturn Value
The time intervall between notifications.
Availability
1.0.0
Discussion
The (approximate) time intervall between notifications sent to the delegate.
Declared In
CDEvents.hsinceEventIdentifier
The event identifier from which events will be supplied to the delegate.
@property (readonly) CDEventIdentifier sinceEventIdentifierReturn Value
The event identifier from which events will be supplied to the delegate.
Availability
1.0.0
Discussion
The event identifier from which events will be supplied to the delegate.
Declared In
CDEvents.hInstance Methods
flushAsynchronously
Flushes the event stream asynchronously.
- (void)flushAsynchronouslyAvailability
1.0.0
Discussion
Flushes the event stream asynchronously.
Flushes the event stream asynchronously by sending events that have already occurred but not yet delivered.
See Also
Declared In
CDEvents.hflushSynchronously
Flushes the event stream synchronously.
- (void)flushSynchronouslyAvailability
1.0.0
Discussion
Flushes the event stream synchronously.
Flushes the event stream synchronously by sending events that have already occurred but not yet delivered.
See Also
Declared In
CDEvents.hinitWithURLs:block:
Returns an CDEvents object initialized with the given URLs to watch.
- (id)initWithURLs:(NSArray *)URLs block:(CDEventsEventBlock)blockParameters
- URLs
 An array of URLs we want to watch.
- block
 The block which the CDEvents object executes when it recieves an event.
Return Value
An CDEvents object initialized with the given URLs to watch.
@throws NSInvalidArgumentException if URLs is empty or points to nil.
@throws NSInvalidArgumentException if delegateis nil.
@throws CDEventsEventStreamCreationFailureException if we failed to create a event stream.
Availability
head
Discussion
Returns an CDEvents object initialized with the given URLs to watch.
See Also
kCDEventsSinceEventNow
@discussion Calls – initWithURLs:block:onRunLoop:sinceEventIdentifier:notificationLantency:ignoreEventsFromSubDirs:excludeURLs:streamCreationFlags: with
sinceEventIdentifierwith the event identifier for “event since now”,notificationLatencyset to 3.0 seconds,ignoreEventsFromSubDirectoriesset toNO,excludedURLstonil, the event stream creation flags will be set tokCDEventsDefaultEventStreamFlagsand schedueled on the current run loop.
Declared In
CDEvents.hinitWithURLs:block:onRunLoop:
Returns an CDEvents object initialized with the given URLs to watch and schedules the watcher on the given run loop.
- (id)initWithURLs:(NSArray *)URLs block:(CDEventsEventBlock)block onRunLoop:(NSRunLoop *)runLoopParameters
- URLs
 An array of URLs we want to watch.
- block
 The block which the CDEvents object executes when it recieves an event.
- runLoop
 The run loop which the which the watcher should be schedueled on.
Return Value
An CDEvents object initialized with the given URLs to watch.
@throws NSInvalidArgumentException if URLs is empty or points to nil.
@throws NSInvalidArgumentException if delegateis nil.
@throws CDEventsEventStreamCreationFailureException if we failed to create a event stream.
Availability
head
Discussion
Returns an CDEvents object initialized with the given URLs to watch and schedules the watcher on the given run loop.
See Also
kCDEventsSinceEventNow
@discussion Calls – initWithURLs:delegate:onRunLoop:sinceEventIdentifier:notificationLantency:ignoreEventsFromSubDirs:excludeURLs:streamCreationFlags: with
sinceEventIdentifierwith the event identifier for “event since now”,notificationLatencyset to 3.0 seconds,ignoreEventsFromSubDirectoriesset toNO,excludedURLstoniland the event stream creation flags will be set tokCDEventsDefaultEventStreamFlags.
Declared In
CDEvents.hinitWithURLs:block:onRunLoop:sinceEventIdentifier:notificationLantency:ignoreEventsFromSubDirs:excludeURLs:streamCreationFlags:
Returns an CDEvents object initialized with the given URLs to watch, URLs to exclude, wheter events from sub-directories are ignored or not and schedules the watcher on the given run loop.
- (id)initWithURLs:(NSArray *)URLs block:(CDEventsEventBlock)block onRunLoop:(NSRunLoop *)runLoop sinceEventIdentifier:(CDEventIdentifier)sinceEventIdentifier notificationLantency:(CFTimeInterval)notificationLatency ignoreEventsFromSubDirs:(BOOL)ignoreEventsFromSubDirs excludeURLs:(NSArray *)exludeURLs streamCreationFlags:(CDEventsEventStreamCreationFlags)streamCreationFlagsParameters
- URLs
 An array of URLs (
NSURL) we want to watch.
- block
 The block which the CDEvents object executes when it recieves an event.
- runLoop
 The run loop which the which the watcher should be schedueled on.
- sinceEventIdentifier
 Events that have happened after the given event identifier will be supplied.
- notificationLatency
 The (approximate) time intervall between notifications sent to the delegate.
- ignoreEventsFromSubDirs
 Wheter events from sub-directories of the watched URLs should be ignored or not.
- exludeURLs
 An array of URLs that we should ignore events from. Pass
nilif none should be excluded.
- streamCreationFlags
 The event stream creation flags.
Return Value
An CDEvents object initialized with the given URLs to watch, URLs to exclude, wheter events from sub-directories are ignored or not and run on the given run loop.
@throws NSInvalidArgumentException if the parameter URLs is empty or points to nil.
@throws NSInvalidArgumentException if delegateis nil.
@throws CDEventsEventStreamCreationFailureException if we failed to create a event stream.
Availability
head
Discussion
Returns an CDEvents object initialized with the given URLs to watch, URLs to exclude, wheter events from sub-directories are ignored or not and schedules the watcher on the given run loop.
See Also
FSEventStreamCreateFlags
@discussion To ask for events “since now” pass the return value of + currentEventIdentifier as the parameter
sinceEventIdentifier. CDEventStreamCreationFailureException should be extremely rare.
Declared In
CDEvents.hinitWithURLs:delegate:
Returns an CDEvents object initialized with the given URLs to watch.
- (id)initWithURLs:(NSArray *)URLs delegate:(id<CDEventsDelegate>)delegateParameters
- URLs
 An array of URLs we want to watch.
- delegate
 The delegate object the CDEvents object calls when it recieves an event.
Return Value
An CDEvents object initialized with the given URLs to watch.
@throws NSInvalidArgumentException if URLs is empty or points to nil.
@throws NSInvalidArgumentException if delegateis nil.
@throws CDEventsEventStreamCreationFailureException if we failed to create a event stream.
Availability
1.0.0
Discussion
Returns an CDEvents object initialized with the given URLs to watch.
See Also
kCDEventsSinceEventNow
@discussion Calls – initWithURLs:delegate:onRunLoop:sinceEventIdentifier:notificationLantency:ignoreEventsFromSubDirs:excludeURLs:streamCreationFlags: with
sinceEventIdentifierwith the event identifier for “event since now”,notificationLatencyset to 3.0 seconds,ignoreEventsFromSubDirectoriesset toNO,excludedURLstonil, the event stream creation flags will be set tokCDEventsDefaultEventStreamFlagsand schedueled on the current run loop.
Declared In
CDEvents.hinitWithURLs:delegate:onRunLoop:
Returns an CDEvents object initialized with the given URLs to watch and schedules the watcher on the given run loop.
- (id)initWithURLs:(NSArray *)URLs delegate:(id<CDEventsDelegate>)delegate onRunLoop:(NSRunLoop *)runLoopParameters
- URLs
 An array of URLs we want to watch.
- delegate
 The delegate object the CDEvents object calls when it recieves an event.
- runLoop
 The run loop which the which the watcher should be schedueled on.
Return Value
An CDEvents object initialized with the given URLs to watch.
@throws NSInvalidArgumentException if URLs is empty or points to nil.
@throws NSInvalidArgumentException if delegateis nil.
@throws CDEventsEventStreamCreationFailureException if we failed to create a event stream.
Availability
1.0.0
Discussion
Returns an CDEvents object initialized with the given URLs to watch and schedules the watcher on the given run loop.
See Also
kCDEventsSinceEventNow
@discussion Calls – initWithURLs:delegate:onRunLoop:sinceEventIdentifier:notificationLantency:ignoreEventsFromSubDirs:excludeURLs:streamCreationFlags: with
sinceEventIdentifierwith the event identifier for “event since now”,notificationLatencyset to 3.0 seconds,ignoreEventsFromSubDirectoriesset toNO,excludedURLstoniland the event stream creation flags will be set tokCDEventsDefaultEventStreamFlags.
Declared In
CDEvents.hinitWithURLs:delegate:onRunLoop:sinceEventIdentifier:notificationLantency:ignoreEventsFromSubDirs:excludeURLs:streamCreationFlags:
Returns an CDEvents object initialized with the given URLs to watch, URLs to exclude, wheter events from sub-directories are ignored or not and schedules the watcher on the given run loop.
- (id)initWithURLs:(NSArray *)URLs delegate:(id<CDEventsDelegate>)delegate onRunLoop:(NSRunLoop *)runLoop sinceEventIdentifier:(CDEventIdentifier)sinceEventIdentifier notificationLantency:(CFTimeInterval)notificationLatency ignoreEventsFromSubDirs:(BOOL)ignoreEventsFromSubDirs excludeURLs:(NSArray *)exludeURLs streamCreationFlags:(CDEventsEventStreamCreationFlags)streamCreationFlagsParameters
- URLs
 An array of URLs (
NSURL) we want to watch.
- delegate
 The delegate object the CDEvents object calls when it recieves an event.
- runLoop
 The run loop which the which the watcher should be schedueled on.
- sinceEventIdentifier
 Events that have happened after the given event identifier will be supplied.
- notificationLatency
 The (approximate) time intervall between notifications sent to the delegate.
- ignoreEventsFromSubDirs
 Wheter events from sub-directories of the watched URLs should be ignored or not.
- exludeURLs
 An array of URLs that we should ignore events from. Pass
nilif none should be excluded.
- streamCreationFlags
 The event stream creation flags.
Return Value
An CDEvents object initialized with the given URLs to watch, URLs to exclude, wheter events from sub-directories are ignored or not and run on the given run loop.
@throws NSInvalidArgumentException if the parameter URLs is empty or points to nil.
@throws NSInvalidArgumentException if delegateis nil.
@throws CDEventsEventStreamCreationFailureException if we failed to create a event stream.
Availability
1.0.0
Discussion
Returns an CDEvents object initialized with the given URLs to watch, URLs to exclude, wheter events from sub-directories are ignored or not and schedules the watcher on the given run loop.
See Also
FSEventStreamCreateFlags
@discussion To ask for events “since now” pass the return value of + currentEventIdentifier as the parameter
sinceEventIdentifier. CDEventStreamCreationFailureException should be extremely rare.
Declared In
CDEvents.hstreamDescription
Returns a NSString containing the description of the current event stream.
- (NSString *)streamDescriptionReturn Value
A NSString containing the description of the current event stream.
Availability
1.0.0
Discussion
Returns a NSString containing the description of the current event stream.
Declared In
CDEvents.h