Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Commit bf0d272

Browse files
committed
dartdocs
1 parent e0271b5 commit bf0d272

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

lib/web_ui/dev/watcher.dart

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,13 @@ enum PipelineStatus {
2020

2121
typedef PipelineStep = Future<void> Function();
2222

23+
/// Represents a sequence of asynchronous tasks to be executed.
24+
///
25+
/// The pipeline can be executed by calling [start] and stopped by calling
26+
/// [stop].
27+
///
28+
/// When a pipeline is stopped, it switches to the [PipelineStatus.stopping]
29+
/// state and waits until the current task finishes.
2330
class Pipeline {
2431
Pipeline({@required this.steps});
2532

@@ -29,6 +36,7 @@ class Pipeline {
2936

3037
PipelineStatus status = PipelineStatus.idle;
3138

39+
/// Starts executing tasks of the pipeline.
3240
Future<void> start() async {
3341
status = PipelineStatus.started;
3442
try {
@@ -49,6 +57,9 @@ class Pipeline {
4957
}
5058
}
5159

60+
/// Stops executing any more tasks in the pipeline.
61+
///
62+
/// If a task is already being executed, it won't be interrupted.
5263
Future<void> stop() {
5364
status = PipelineStatus.stopping;
5465
return (_currentStepFuture ?? Future<void>.value(null)).then((_) {
@@ -57,8 +68,14 @@ class Pipeline {
5768
}
5869
}
5970

71+
/// Signature of functions to be called when a [WatchEvent] is received.
6072
typedef WatchEventPredicate = bool Function(WatchEvent event);
6173

74+
/// Responsible for watching a directory [dir] and executing the given
75+
/// [pipeline] whenever a change occurs in the directory.
76+
///
77+
/// The [ignore] callback can be used to customize the watching behavior to
78+
/// ignore certain files.
6279
class PipelineWatcher {
6380
PipelineWatcher({
6481
@required this.dir,
@@ -79,6 +96,7 @@ class PipelineWatcher {
7996
/// given [WatchEvent] instance.
8097
final WatchEventPredicate ignore;
8198

99+
/// Activates the watcher.
82100
void start() {
83101
watcher.events.listen(_onEvent);
84102
}

0 commit comments

Comments
 (0)