An Objective-C wrapper for Mac OS X’s FSEvents C API.
修訂 | 4e5bf67637a2d5e9457d47cfa3b09e681020eb21 (tree) |
---|---|
時間 | 2010-04-04 00:14:29 |
作者 | Aron Cedercrantz <aron@cede...> |
Commiter | Aron Cedercrantz |
Changed the way to start/init a CDEvents object.
@@ -175,35 +175,39 @@ | ||
175 | 175 | + (CDEventIdentifier)lastEventIdentifierForURL:(NSURL *)URL time:(NSDate *)time; |
176 | 176 | |
177 | 177 | |
178 | -#pragma mark Start and stop watching paths | |
178 | +#pragma mark Init methods | |
179 | 179 | /** |
180 | 180 | * Returns an <code>CDEvents</code> object initialized with the given URLs to watch. |
181 | 181 | * |
182 | 182 | * @param URLs An array of URLs we want to watch. |
183 | + * @param delegate The delegate object the <code>CDEvents</code> object calls when it recieves an event. | |
183 | 184 | * @return An <code>CDEvents</code> object initialized with the given URLs to watch. |
184 | 185 | * @throws NSInvalidArgumentException if <em>URLs</em> is empty or points to <code>nil</code>. |
186 | + * @throws NSInvalidArgumentException if <em>delegate</em>is <code>nil</code>. | |
185 | 187 | * |
186 | - * @see startWatchingURLs:onRunLoop: | |
187 | - * @see startWatchingURLs:onRunLoop:notificationLantency:ignoreEventsFromSubDirs:excludeURLs: | |
188 | + * @see startWatchingURLs:delegate:onRunLoop: | |
189 | + * @see startWatchingURLs:delegate:onRunLoop:notificationLantency:ignoreEventsFromSubDirs:excludeURLs: | |
188 | 190 | * @see stopWatchingURLs |
189 | 191 | * |
190 | 192 | * @discussion Calls startWatchingURLs:onRunLoop:notificationLantency:ignoreEventsFromSubDirs:excludeURLs: |
191 | - * with <em>runLoop</em> set to the current run loop, <em>sinceEventIdentifier</em> | |
192 | - * with the current event identifier, <em>notificationLatency</em> set to 3.0 | |
193 | - * seconds, <em>ignoreEventsFromSubDirectories</em> set to <code>NO</code> | |
194 | - * <em>excludedURLs</em> to no URLs. and schedueled on the current run loop. | |
193 | + * with <em>sinceEventIdentifier</em> with the current event identifier, | |
194 | + * <em>notificationLatency</em> set to 3.0 seconds, | |
195 | + * <em>ignoreEventsFromSubDirectories</em> set to <code>NO</code> | |
196 | + * <em>excludedURLs</em> to no URLs and schedueled on the current run loop. | |
195 | 197 | * |
196 | 198 | * @since 1.0.0 |
197 | 199 | */ |
198 | -- (void)startWatchingURLs:(NSArray *)URLs; | |
200 | +- (id)initWithURLs:(NSArray *)URLs delegate:(id<CDEventsDelegate>)delegate; | |
199 | 201 | |
200 | 202 | /** |
201 | 203 | * Returns an <code>CDEvents</code> object initialized with the given URLs to watch and schedules the watcher on the given run loop. |
202 | 204 | * |
203 | 205 | * @param URLs An array of URLs we want to watch. |
206 | + * @param delegate The delegate object the <code>CDEvents</code> object calls when it recieves an event. | |
204 | 207 | * @param The run loop which the which the watcher should be schedueled on. |
205 | 208 | * @return An <code>CDEvents</code> object initialized with the given URLs to watch. |
206 | 209 | * @throws NSInvalidArgumentException if <em>URLs</em> is empty or points to <code>nil</code>. |
210 | + * @throws NSInvalidArgumentException if <em>delegate</em>is <code>nil</code>. | |
207 | 211 | * |
208 | 212 | * @see startWatchingURLs: |
209 | 213 | * @see startWatchingURLs:onRunLoop:notificationLantency:ignoreEventsFromSubDirs:excludeURLs: |
@@ -217,12 +221,15 @@ | ||
217 | 221 | * |
218 | 222 | * @since 1.0.0 |
219 | 223 | */ |
220 | -- (void)startWatchingURLs:(NSArray *)URLs onRunLoop:(NSRunLoop *)runLoop; | |
224 | +- (void)initWithURLs:(NSArray *)URLs | |
225 | + delegate:(id<CDEventsDelegate>)delegate | |
226 | + onRunLoop:(NSRunLoop *)runLoop; | |
221 | 227 | |
222 | 228 | /** |
223 | 229 | * Returns an <code>CDEvents</code> 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. |
224 | 230 | * |
225 | 231 | * @param URLs An array of URLs we want to watch. |
232 | + * @param delegate The delegate object the <code>CDEvents</code> object calls when it recieves an event. | |
226 | 233 | * @param runLoop The run loop which the which the watcher should be schedueled on. |
227 | 234 | * @param sinceEventIdentifier Events that have happened after the given event identifier will be supplied. |
228 | 235 | * @param notificationLatency The (approximate) time intervall between notifications sent to the delegate. |
@@ -230,6 +237,7 @@ | ||
230 | 237 | * @param exludeURLs An array of URLs that we should ignore events from. Pass <code>nil</code> if none should be excluded. |
231 | 238 | * @return An <code>CDEvents</code> 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. |
232 | 239 | * @throws NSInvalidArgumentException if the parameter URLs is empty or points to <code>nil</code>. |
240 | + * @throws NSInvalidArgumentException if <em>delegate</em>is <code>nil</code>. | |
233 | 241 | * |
234 | 242 | * @see startWatchingURLs: |
235 | 243 | * @see startWatchingURLs:onRunLoop: |
@@ -242,23 +250,13 @@ | ||
242 | 250 | * |
243 | 251 | * @since 1.0.0 |
244 | 252 | */ |
245 | -- (void)startWatchingURLs:(NSArray *)URLs | |
246 | - onRunLoop:(NSRunLoop *)runLoop | |
247 | - sinceEventIdentifier:(CDEventIdentifier)sinceEventIdentifier | |
248 | - notificationLantency:(CFTimeInterval)notificationLatency | |
249 | - ignoreEventsFromSubDirs:(BOOL)ignoreEventsFromSubDirs | |
250 | - excludeURLs:(NSArray *)exludeURLs; | |
251 | - | |
252 | -/** | |
253 | - * Stop watching the URLs. | |
254 | - * | |
255 | - * @see startWatchingURLs: | |
256 | - * @see startWatchingURLs:onRunLoop: | |
257 | - * @see startWatchingURLs:onRunLoop:notificationLantency:ignoreEventsFromSubDirs:excludeURLs: | |
258 | - * | |
259 | - * @since 1.0.0 | |
260 | - */ | |
261 | -- (void)stopWatchingURLs; | |
253 | +- (void)initWithURLs:(NSArray *)URLs | |
254 | + delegate:(id<CDEventsDelegate>)delegate | |
255 | + onRunLoop:(NSRunLoop *)runLoop | |
256 | +sinceEventIdentifier:(CDEventIdentifier)sinceEventIdentifier | |
257 | +notificationLantency:(CFTimeInterval)notificationLatency | |
258 | +ignoreEventsFromSubDirs:(BOOL)ignoreEventsFromSubDirs | |
259 | + excludeURLs:(NSArray *)exludeURLs; | |
262 | 260 | |
263 | 261 | #pragma mark Flush methods |
264 | 262 |