Skip to content

Implement use_location #721

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 21 commits into from
Apr 8, 2022
Merged
Show file tree
Hide file tree
Changes from 13 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -9,31 +9,20 @@ <h1>This is an Example App</h1>
<p>Just below is an embedded IDOM view...</p>
<div id="idom-app" />
<script type="module">
import { mountLayoutWithWebSocket } from "https://esm.sh/[email protected]";
import {
mountWithLayoutServer,
LayoutServerInfo,
} from "https://esm.sh/[email protected]";

// get the correct web socket protocol
let wsURL;
if (window.location.protocol === "https:") {
wsURL = "wss:";
} else {
wsURL = "ws:";
}
wsURL += "//" + window.location.host;
const serverInfo = new LayoutServerInfo({
host: document.location.hostname,
port: document.location.port,
path: "_idom",
query: queryParams.user.toString(),
secure: document.location.protocol == "https:",
});

// append path to the web socket
wsURL += "/_idom/stream";

// only needed for views that use web modules
const loadImportSource = (source, sourceType) =>
sourceType == "NAME"
? import("_idom/_modules/" + source)
: import(source);

mountLayoutWithWebSocket(
document.getElementById("idom-app"),
wsURL,
loadImportSource
);
mountLayoutWithWebSocket(document.getElementById("idom-app"), serverInfo);
</script>
</body>
</html>
3 changes: 3 additions & 0 deletions noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -390,5 +390,8 @@ def get_idom_script_env() -> dict[str, str]:
return {
"PYTHONPATH": os.getcwd(),
"IDOM_DEBUG_MODE": os.environ.get("IDOM_DEBUG_MODE", "1"),
"IDOM_TESTING_DEFAULT_TIMEOUT": os.environ.get(
"IDOM_TESTING_DEFAULT_TIMEOUT", "6.0"
),
"IDOM_CHECK_VDOM_SPEC": os.environ.get("IDOM_CHECK_VDOM_SPEC", "0"),
}
5 changes: 3 additions & 2 deletions requirements/pkg-deps.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
typing-extensions >=3.10
mypy-extensions >=0.4.3
anyio >=3.0
anyio >=3
jsonpatch >=1.32
fastjsonschema >=2.14.5
requests >=2.0
requests >=2
colorlog >=6
werkzeug >=2
4 changes: 2 additions & 2 deletions requirements/pkg-extras.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ fastapi >=0.63.0
uvicorn[standard] >=0.13.4

# extra=flask
flask<2.0
flask
markupsafe<2.1
flask-cors
flask-sockets
flask-sock

# extra=tornado
tornado
Expand Down
Loading