File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11{
22 "name" : " talkops" ,
33 "description" : " TalkOps SDK" ,
4- "version" : " 2.12 .0" ,
4+ "version" : " 2.13 .0" ,
55 "author" : " bierdok" ,
66 "license" : " MIT" ,
77 "main" : " index.mjs" ,
Original file line number Diff line number Diff line change @@ -9,6 +9,7 @@ export default class Publisher {
99 constructor ( useConfig , useState ) {
1010 this . #useConfig = useConfig
1111 this . #useState = useState
12+ setTimeout ( ( ) => this . #publishData( JSON . stringify ( { type : 'init' } ) ) , 900 )
1213 setTimeout ( ( ) => this . #publishState( ) , 1000 )
1314
1415 const originalStdoutWrite = process . stdout . write
@@ -42,12 +43,16 @@ export default class Publisher {
4243
4344 async publishEvent ( event ) {
4445 if ( this . #lastPingAt && this . #lastPingAt < new Date ( ) . getTime ( ) - 6000 ) return
46+ this . #publishData( JSON . stringify ( event ) )
47+ }
48+
49+ async #publishData( data ) {
4550 const config = this . #useConfig( )
4651 await axios . post (
4752 config . mercure . url ,
4853 new URLSearchParams ( {
4954 topic : config . mercure . publisher . topic ,
50- data : JSON . stringify ( event ) ,
55+ data,
5156 } ) ,
5257 {
5358 headers : {
You can’t perform that action at this time.
0 commit comments