(obj: any)
| 53 | return this.queue.length; |
| 54 | } |
| 55 | postMessage(obj: any) { |
| 56 | return new Promise((res) => { |
| 57 | const queue = this.queue; |
| 58 | obj = Object.assign({}, obj); |
| 59 | if (obj.image_dir === null) obj.image_dir = "clipboard"; |
| 60 | else obj.image_dir = path_resolve(obj.image_dir); |
| 61 | queue.push( |
| 62 | () => |
| 63 | new Promise((res_: any) => { |
| 64 | super.once( |
| 65 | "message", |
| 66 | (data: any) => ( |
| 67 | res({ |
| 68 | code: data.code, |
| 69 | message: data.code - 100 ? data.data : "", |
| 70 | data: data.code - 100 ? null : data.data, |
| 71 | }), |
| 72 | res_() |
| 73 | ) |
| 74 | ); |
| 75 | super.postMessage(obj); |
| 76 | }) |
| 77 | ); |
| 78 | }); |
| 79 | } |
| 80 | flush(obj: any) { |
| 81 | return this.postMessage(obj); |
| 82 | } |
no test coverage detected