@@ -6,19 +6,6 @@ abstract class BridgeComponent<in D : BridgeDestination>(
6
6
) {
7
7
private val receivedMessages = hashMapOf<String , Message >()
8
8
9
- internal fun didReceive (message : Message ) {
10
- receivedMessages[message.event] = message
11
- onReceive(message)
12
- }
13
-
14
- internal fun didStart () {
15
- onStart()
16
- }
17
-
18
- internal fun didStop () {
19
- onStop()
20
- }
21
-
22
9
/* *
23
10
* Returns the last received message for a given `event`, if available.
24
11
*/
@@ -32,6 +19,38 @@ abstract class BridgeComponent<in D : BridgeDestination>(
32
19
*/
33
20
abstract fun onReceive (message : Message )
34
21
22
+ /* *
23
+ * This passes a received message to onReceive(message), caching it
24
+ * for use with replyTo(event) and receivedMessageFor(event).
25
+ *
26
+ * NOTE: This should not be called directly from within a component,
27
+ * but is available to use for testing.
28
+ */
29
+ fun didReceive (message : Message ) {
30
+ receivedMessages[message.event] = message
31
+ onReceive(message)
32
+ }
33
+
34
+ /* *
35
+ * This passes the start lifecycle event to onStart().
36
+ *
37
+ * NOTE: This should not be called directly from within a component,
38
+ * but is available to use for testing.
39
+ */
40
+ fun didStart () {
41
+ onStart()
42
+ }
43
+
44
+ /* *
45
+ * This passes the stop lifecycle event to onStop().
46
+ *
47
+ * NOTE: This should not be called directly from within a component,
48
+ * but is available to use for testing.
49
+ */
50
+ fun didStop () {
51
+ onStop()
52
+ }
53
+
35
54
/* *
36
55
* Called when the component's destination starts (and is active)
37
56
* based on its lifecycle events. You can use this as an opportunity
0 commit comments