OLD | NEW |
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 part of dart.io; | 5 part of dart.io; |
6 | 6 |
7 class FileSystemEntityType { | 7 class FileSystemEntityType { |
8 static const FILE = const FileSystemEntityType._internal(0); | 8 static const FILE = const FileSystemEntityType._internal(0); |
9 static const DIRECTORY = const FileSystemEntityType._internal(1); | 9 static const DIRECTORY = const FileSystemEntityType._internal(1); |
10 static const LINK = const FileSystemEntityType._internal(2); | 10 static const LINK = const FileSystemEntityType._internal(2); |
(...skipping 337 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
348 * * `Windows`: Uses `ReadDirectoryChangesW`. The implementation only | 348 * * `Windows`: Uses `ReadDirectoryChangesW`. The implementation only |
349 * supports watching directories. Recursive watching is supported. | 349 * supports watching directories. Recursive watching is supported. |
350 * * `Linux`: Uses `inotify`. The implementation supports watching both | 350 * * `Linux`: Uses `inotify`. The implementation supports watching both |
351 * files and directories. Recursive watching is not supported. | 351 * files and directories. Recursive watching is not supported. |
352 * * `Mac OS`: Uses `FSEvents`. The implementation supports watching both | 352 * * `Mac OS`: Uses `FSEvents`. The implementation supports watching both |
353 * files and directories. Recursive watching is supported. | 353 * files and directories. Recursive watching is supported. |
354 * | 354 * |
355 * The system will start listening for events once the returned [Stream] is | 355 * The system will start listening for events once the returned [Stream] is |
356 * being listened to, not when the call to [watch] is issued. | 356 * being listened to, not when the call to [watch] is issued. |
357 * | 357 * |
358 * Note that the returned [Stream] is endless, unless: | 358 * The returned value is an endless broadcast [Stream], that only stops when |
| 359 * one of the following happends: |
359 * | 360 * |
360 * * The [Stream] is canceled, e.g. by calling `cancel` on the | 361 * * The [Stream] is canceled, e.g. by calling `cancel` on the |
361 * [StreamSubscription]. | 362 * [StreamSubscription]. |
362 * * The [FileSystemEntity] being watches, is deleted. | 363 * * The [FileSystemEntity] being watches, is deleted. |
363 */ | 364 */ |
364 Stream<FileSystemEvent> watch({int events: FileSystemEvent.ALL, | 365 Stream<FileSystemEvent> watch({int events: FileSystemEvent.ALL, |
365 bool recursive: false}) | 366 bool recursive: false}) |
366 => new _FileSystemWatcher(_trimTrailingPathSeparators(path), | 367 => new _FileSystemWatcher(_trimTrailingPathSeparators(path), |
367 events, | 368 events, |
368 recursive).stream; | 369 recursive).stream; |
(...skipping 338 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
707 } | 708 } |
708 } | 709 } |
709 | 710 |
710 | 711 |
711 abstract class _FileSystemWatcher { | 712 abstract class _FileSystemWatcher { |
712 external factory _FileSystemWatcher(String path, int events, bool recursive); | 713 external factory _FileSystemWatcher(String path, int events, bool recursive); |
713 external static bool get isSupported; | 714 external static bool get isSupported; |
714 | 715 |
715 Stream<FileSystemEvent> get stream; | 716 Stream<FileSystemEvent> get stream; |
716 } | 717 } |
OLD | NEW |