mirror of
https://github.com/dillonkearns/elm-pages-v3-beta.git
synced 2024-11-27 01:12:50 +03:00
Check if port is defined before subscribing to avoid error if port is unused.
This commit is contained in:
parent
91c87dd235
commit
cfbbf71bf5
@ -27,7 +27,7 @@ function loadContentAndInitializeApp() {
|
||||
loadNamedAnchor();
|
||||
});
|
||||
|
||||
app.ports.elmPagesReloadData.subscribe(() => {
|
||||
app.ports.elmPagesReloadData && app.ports.elmPagesReloadData.subscribe(() => {
|
||||
console.log("RELOAD DATA PORT!");
|
||||
app.ports.fromJsPort.send(null);
|
||||
});
|
||||
|
@ -28,10 +28,11 @@ function loadContentAndInitializeApp() {
|
||||
loadNamedAnchor();
|
||||
});
|
||||
|
||||
app.ports.elmPagesReloadData.subscribe(() => {
|
||||
console.log("RELOAD DATA PORT!");
|
||||
app.ports.fromJsPort.send(null);
|
||||
});
|
||||
app.ports.elmPagesReloadData &&
|
||||
app.ports.elmPagesReloadData.subscribe(() => {
|
||||
console.log("RELOAD DATA PORT!");
|
||||
app.ports.fromJsPort.send(null);
|
||||
});
|
||||
|
||||
return app;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user