File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -68,8 +68,8 @@ export function createSynclet(
6868export interface Connector {
6969 __brand : 'Connector' ;
7070 log ( message : string , level ?: LogLevel ) : void ;
71- start ( ) : Promise < void > ;
72- stop ( ) : Promise < void > ;
71+ connect ( ) : Promise < void > ;
72+ disconnect ( ) : Promise < void > ;
7373 setAtom : (
7474 address : Address ,
7575 atom : Atom ,
Original file line number Diff line number Diff line change @@ -40,7 +40,7 @@ export const createConnector: typeof createConnectorDecl = async (
4040 } : ConnectorImplementations ,
4141 options : ConnectorOptions = { } ,
4242) : Promise < ProtectedConnector > => {
43- let started = false ;
43+ let connected = false ;
4444 let attachedSynclet : Synclet | undefined ;
4545
4646 const id = options . id ?? getUniqueId ( ) ;
@@ -60,19 +60,19 @@ export const createConnector: typeof createConnectorDecl = async (
6060
6161 log,
6262
63- start : async ( ) => {
64- if ( ! started ) {
65- log ( 'start ' ) ;
63+ connect : async ( ) => {
64+ if ( ! connected ) {
65+ log ( 'connect ' ) ;
6666 await connect ?.( ) ;
67- started = true ;
67+ connected = true ;
6868 }
6969 } ,
7070
71- stop : async ( ) => {
72- if ( started ) {
73- log ( 'stop ' ) ;
71+ disconnect : async ( ) => {
72+ if ( connected ) {
73+ log ( 'disconnect ' ) ;
7474 await disconnect ?.( ) ;
75- started = false ;
75+ connected = false ;
7676 }
7777 } ,
7878
@@ -143,8 +143,6 @@ export const createConnector: typeof createConnectorDecl = async (
143143 attachedSynclet = synclet ;
144144 } ,
145145
146- connect,
147- disconnect,
148146 readAtom,
149147 readTimestamp,
150148 readHash,
Original file line number Diff line number Diff line change @@ -22,8 +22,6 @@ export type Message = [
2222export type ReceiveMessage = ( message : Message , from : string ) => Promise < void > ;
2323
2424export interface ProtectedConnector extends Connector {
25- connect ?: ( ) => Promise < void > ;
26- disconnect ?: ( ) => Promise < void > ;
2725 attachToSynclet ( synclet : Synclet ) : void ;
2826 readAtom ( address : Address , context : Context ) : Promise < Atom | undefined > ;
2927 readTimestamp (
Original file line number Diff line number Diff line change @@ -294,7 +294,7 @@ export const createSynclet: typeof createSyncletDecl = (async (
294294 start : async ( ) => {
295295 if ( ! started ) {
296296 log ( 'start' ) ;
297- await connector . start ( ) ;
297+ await connector . connect ( ) ;
298298 await transport . connect ?.( receiveMessage ) ;
299299 started = true ;
300300 await sync ( [ ] ) ;
You can’t perform that action at this time.
0 commit comments