MCPcopy Create free account
hub / github.com/NativeScript/SimDeck / loadState

Function loadState

packages/client/src/app/AppShell.tsx:693–722  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

691 let controller: AbortController | null = null;
692
693 const loadState = () => {
694 controller?.abort();
695 controller =
696 typeof AbortController !== "undefined" ? new AbortController() : null;
697 void fetchSimulatorState(
698 udid,
699 controller ? { signal: controller.signal } : {},
700 )
701 .then((state) => {
702 if (!cancelled) {
703 setSelectedSimulatorState(state);
704 }
705 })
706 .catch((error) => {
707 if (
708 !cancelled &&
709 !(error instanceof DOMException && error.name === "AbortError")
710 ) {
711 setSelectedSimulatorState(null);
712 }
713 })
714 .finally(() => {
715 if (!cancelled) {
716 timeoutId = window.setTimeout(
717 loadState,
718 baseSelectedSimulator?.isBooted ? 1000 : 3000,
719 );
720 }
721 });
722 };
723
724 setSelectedSimulatorState(null);
725 loadState();

Callers 1

AppShellFunction · 0.85

Calls 3

fetchSimulatorStateFunction · 0.90
setTimeoutMethod · 0.80
abortMethod · 0.65

Tested by

no test coverage detected