Skip to content

Commit

Permalink
feat(protocol_interfaces): introduce ProtocolSubscription class
Browse files Browse the repository at this point in the history
  • Loading branch information
JKRhb committed May 24, 2024
1 parent 509969a commit 380e203
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 0 deletions.
1 change: 1 addition & 0 deletions lib/src/core/protocol_interfaces.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@
export "protocol_interfaces/protocol_client.dart";
export "protocol_interfaces/protocol_client_factory.dart";
export "protocol_interfaces/protocol_server.dart";
export "protocol_interfaces/protocol_subscription.dart";
30 changes: 30 additions & 0 deletions lib/src/core/protocol_interfaces/protocol_subscription.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
// Copyright 2024 Contributors to the Eclipse Foundation. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
//
// SPDX-License-Identifier: BSD-3-Clause

import "package:meta/meta.dart";

import "../scripting_api.dart";

/// Base class for implementations of the [Subscription] interface.
abstract base class ProtocolSubscription implements Subscription {
/// Instantiates a new [ProtocolSubscription].
///
/// The [_complete] callback will be called when the [ProtocolSubscription]
/// has been [stop]ped (either internally or externally).
ProtocolSubscription(this._complete);

final void Function() _complete;

@override
@mustCallSuper
Future<void> stop({
int? formIndex,
Map<String, Object>? uriVariables,
Object? data,
}) async {
_complete();
}
}

0 comments on commit 380e203

Please sign in to comment.