(appSinks: Object | null)
| 323 | let started = false; |
| 324 | |
| 325 | function startGraphSerializer(appSinks: Object | null) { |
| 326 | if (started) { |
| 327 | return; |
| 328 | } |
| 329 | const serializerSources: GraphSerializerSources = { |
| 330 | id: xs.of(`graph-${Math.round(Math.random() * 1000000000)}`), |
| 331 | DebugSinks: xs.of(appSinks), |
| 332 | FromPanel: panelMessage$, |
| 333 | Settings: xs.of<SessionSettings>(window['CyclejsDevToolSettings']), |
| 334 | }; |
| 335 | const serializerSinks = GraphSerializer(serializerSources); |
| 336 | |
| 337 | serializerSinks.graph.addListener({ |
| 338 | next: graph => { |
| 339 | // console.log('GRAPH SERIALIZER send message to CONTENT SCRIPT: ' + graph); |
| 340 | // Send message to the CONTENT SCRIPT |
| 341 | const event = new CustomEvent('CyclejsDevToolEvent', {detail: graph}); |
| 342 | document.dispatchEvent(event); |
| 343 | }, |
| 344 | error: (err: any) => { |
| 345 | console.error('Cycle.js DevTool (graph serializer):\n' + err); |
| 346 | console.error(err.stack); |
| 347 | }, |
| 348 | complete: () => {}, |
| 349 | }); |
| 350 | started = true; |
| 351 | } |
| 352 | |
| 353 | window['CyclejsDevTool_startGraphSerializer'] = startGraphSerializer; |
| 354 |
no test coverage detected