File tree 2 files changed +14
-6
lines changed
2 files changed +14
-6
lines changed Original file line number Diff line number Diff line change @@ -144,7 +144,7 @@ export default class Runtime extends EventEmitter {
144
144
for ( const plugin of this . plugins ) {
145
145
await plugin . onDestroy ( )
146
146
}
147
- this . ncc . disconnect ( )
147
+ this . ncc . destory ( )
148
148
} catch ( err ) {
149
149
Log . e ( err )
150
150
process . exit ( - 1 )
Original file line number Diff line number Diff line change @@ -355,23 +355,31 @@ export default class Ncc extends NcFetch {
355
355
return Promise . resolve ( )
356
356
}
357
357
/**
358
- * Remove autoSync
358
+ * Clear connected and joined channels (Cache)
359
359
*
360
- * This is not removing AUTH! (see `ncc.logout()`)
360
+ * This doesn't effect on naver ID
361
361
*/
362
- public disconnect ( ) {
362
+ public clearChannels ( ) {
363
363
if ( this . syncTask != null ) {
364
364
clearTimeout ( this . syncTask )
365
365
}
366
366
this . connectedChannels . forEach ( ( v ) => v . disconnect ( ) )
367
367
this . connectedChannels = [ ]
368
368
this . joinedChannels = [ ]
369
+ }
370
+ /**
371
+ * Destory Ncc
372
+ *
373
+ * Unusable this object if call.
374
+ */
375
+ public destory ( ) {
376
+ this . clearChannels ( )
369
377
for ( const e of Object . values ( this . events ) ) {
370
378
if ( typeof e [ "clear" ] === "function" ) {
371
379
e . clear ( )
372
380
}
373
381
}
374
- // this.credit = new NCredit()
382
+ this . credit = new NCredit ( )
375
383
}
376
384
/**
377
385
* Sync Channels and fetch auto
@@ -512,7 +520,7 @@ export default class Ncc extends NcFetch {
512
520
return super . onLogin ( username )
513
521
}
514
522
protected async onLogout ( ) :Promise < void > {
515
- this . disconnect ( )
523
+ this . clearChannels ( )
516
524
return super . onLogout ( )
517
525
}
518
526
/**
You can’t perform that action at this time.
0 commit comments