File tree 1 file changed +12
-2
lines changed
packages/perseus-editor/src
1 file changed +12
-2
lines changed Original file line number Diff line number Diff line change 9
9
* to get the data to render. When the iframe is loaded, it's javascript sends
10
10
* a message to the parent, which triggers the parent to send the current data.
11
11
*/
12
- import { UnreachableCaseError } from "@khanacademy/wonder-stuff-core" ;
13
12
import * as React from "react" ;
14
13
15
14
import {
@@ -24,6 +23,12 @@ let nextIframeID = 0;
24
23
const requestIframeData : Record < string , any > = { } ;
25
24
const updateIframeHeight : Record < string , any > = { } ;
26
25
26
+ /**
27
+ * Processes a message sent to the iframe parent (ie. this component).
28
+ *
29
+ * Note that this handler also sees messages sent from itself to the iframe so
30
+ * we intentionally ignore those here.
31
+ */
27
32
function processIframeParentMessage ( message : MessageToIFrameParent ) {
28
33
if ( ! isPerseusMessage ( message ) ) {
29
34
return ;
@@ -45,7 +50,12 @@ function processIframeParentMessage(message: MessageToIFrameParent) {
45
50
return ;
46
51
47
52
default :
48
- throw new UnreachableCaseError ( messageType ) ;
53
+ // This is a type assertion that ensures we handle all of the types
54
+ // of messages we handle. We do _not_ throw an UnreachableCaseError
55
+ // here because this handler also sees messages sent from this
56
+ // component and those are not currently filtered by
57
+ // isPerseusMessage().
58
+ const _ : never = messageType ;
49
59
}
50
60
}
51
61
You can’t perform that action at this time.
0 commit comments