2323
2424import { DOMAdaptor , minWorker } from '../../core/DOMAdaptor.js' ;
2525import { OptionList } from '../../util/Options.js' ;
26- import {
27- Message ,
28- ClientCommand ,
29- Structure ,
30- } from './MessageTypes.js' ;
26+ import { Message , ClientCommand , Structure } from './MessageTypes.js' ;
3127import { SpeechMathItem } from '../speech.js' ;
3228import { SemAttr } from './SpeechUtil.js' ;
3329
@@ -51,7 +47,6 @@ class Task<N, T, D> {
5147 * @template D The Document class
5248 */
5349export class WorkerHandler < N , T , D > {
54-
5550 /**
5651 * Callback for ready signal
5752 */
@@ -78,13 +73,15 @@ export class WorkerHandler<N, T, D> {
7873 private options : OptionList
7974 ) { }
8075
81-
8276 /**
8377 * This starts the worker.
8478 */
8579 public async Start ( ) {
8680 if ( this . ready ) throw Error ( 'Worker already started' ) ;
87- this . worker = await this . adaptor . createWorker ( this . Listener . bind ( this ) , this . options ) ;
81+ this . worker = await this . adaptor . createWorker (
82+ this . Listener . bind ( this ) ,
83+ this . options
84+ ) ;
8885 }
8986
9087 /**
@@ -125,7 +122,10 @@ export class WorkerHandler<N, T, D> {
125122 * command name as input.
126123 * @returns {Promise<any> } A promise that resolves when the command completes
127124 */
128- public Post ( msg : ClientCommand , item ?: SpeechMathItem < N , T , D > ) : Promise < any > {
125+ public Post (
126+ msg : ClientCommand ,
127+ item ?: SpeechMathItem < N , T , D >
128+ ) : Promise < any > {
129129 const promise = new Promise ( ( resolve , reject ) => {
130130 this . tasks . push ( new Task ( msg , item , resolve , reject ) ) ;
131131 } ) ;
@@ -140,7 +140,9 @@ export class WorkerHandler<N, T, D> {
140140 */
141141 private postNext ( ) {
142142 if ( this . tasks . length ) {
143- const msg = Object . assign ( { } , this . tasks [ 0 ] . cmd , { debug : this . options . debug } ) ;
143+ const msg = Object . assign ( { } , this . tasks [ 0 ] . cmd , {
144+ debug : this . options . debug ,
145+ } ) ;
144146 this . worker . postMessage ( msg ) ;
145147 }
146148 }
@@ -581,7 +583,7 @@ export class WorkerHandler<N, T, D> {
581583 */
582584 Log ( handler : WorkerHandler < N , T , D > , data : Message ) {
583585 if ( handler . options . debug ) {
584- console . log ( " Log:" , data ) ;
586+ console . log ( ' Log:' , data ) ;
585587 }
586588 } ,
587589 } ;
0 commit comments