1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
/*
2022-05-20
The author disclaims copyright to this source code. In place of a
legal notice, here is a blessing:
* May you do good and not evil.
* May you find forgiveness for yourself and forgive others.
* May you share freely, never taking more than you give.
***********************************************************************
This is the JS Worker file for the pikchr fiddle app. It loads the
pikchr wasm module and offers access to it via the Worker
message-passing interface.
Because we can have only a single message handler, as opposed to an
arbitrary number of discrete event listeners like with DOM elements,
we have to define a lower-level message API. Messages abstractly
look like:
|
|
|
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
/*
2022-05-20
The author disclaims copyright to this source code. In place of a
legal notice, here is a blessing:
* May you do good and not evil.
* May you find forgiveness for yourself and forgive others.
* May you share freely, never taking more than you give.
***********************************************************************
This is a JS Worker file for use with the pikchr wasm build. It
loads the pikchr wasm module and offers access to it via the Worker
message-passing interface.
Because we can have only a single message handler, as opposed to an
arbitrary number of discrete event listeners like with DOM elements,
we have to define a lower-level message API. Messages abstractly
look like:
|
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
|
- pikchr:
{type: 'pikchr',
data:{
pikchr: input text,
result: rendered result (SVG on success, HTML on error),
isError: bool, true if .pikchr holds an error report,
flags: integer: flags used to configure the pikchr rendering,
width: if !isError, width (pixels) of the SVG,
height: if !isError, height (pixels) of the SVG
}
}
*/
"use strict";
(function(){
|
|
|
|
|
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
|
- pikchr:
{type: 'pikchr',
data:{
pikchr: input text,
result: rendered result (SVG on success, HTML on error),
isError: bool, true if .result holds an error report,
flags: integer: flags used to configure the pikchr rendering,
width: if !isError, width (integer pixels) of the SVG,
height: if !isError, height (integer pixels) of the SVG
}
}
*/
"use strict";
(function(){
|