/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
if (!page) { thrownew Error("No page provided.");
}
const currentPage = getState().ui.selectedPage; // Nothing to dispatch if the page is the same as the current page if (isSamePage(currentPage, page)) { return;
}
// Stop showing the profiler dialog if we are navigating to another page. if (getState().ui.showProfilerDialog) {
await dispatch({ type: HIDE_PROFILER_DIALOG });
}
// Stop watching current runtime, if currently on a RUNTIME page. if (currentPage === PAGE_TYPES.RUNTIME) { const currentRuntimeId = getState().runtimes.selectedRuntimeId;
await dispatch(Actions.unwatchRuntime(currentRuntimeId));
}
// Always update the selected runtime id. // If we are navigating to a non-runtime page, the Runtime page components are no // longer rendered so it is safe to nullify the runtimeId. // If we are navigating to a runtime page, the runtime corresponding to runtimeId // is already connected, so components can safely get runtimeDetails on this new // runtime.
dispatch({ type: SELECTED_RUNTIME_ID_UPDATED, runtimeId });
// Start watching current runtime, if moving to a RUNTIME page. if (page === PAGE_TYPES.RUNTIME) {
await dispatch(Actions.watchRuntime(runtimeId));
}
function addNetworkLocation(location) { return () => {
NetworkLocationsModule.addNetworkLocation(location);
};
}
function removeNetworkLocation(location) { return () => {
NetworkLocationsModule.removeNetworkLocation(location);
};
}
function showProfilerDialog() { return { type: SHOW_PROFILER_DIALOG };
}
/** * The profiler can switch between "devtools-remote" and "aboutprofiling-remote" * page contexts.
*/ function switchProfilerContext(profilerContext) { return { type: SWITCH_PROFILER_CONTEXT, profilerContext };
}
function hideProfilerDialog() { return { type: HIDE_PROFILER_DIALOG };
}
function updateAdbAddonStatus(adbAddonStatus) { return { type: ADB_ADDON_STATUS_UPDATED, adbAddonStatus };
}
function updateAdbReady(isAdbReady) { return { type: ADB_READY_UPDATED, isAdbReady };
}
try { // "aboutdebugging" will be forwarded to telemetry as the installation source // for the addon.
await adbAddon.install("about:debugging");
dispatch({ type: ADB_ADDON_INSTALL_SUCCESS });
} catch (e) {
dispatch({ type: ADB_ADDON_INSTALL_FAILURE, error: e });
}
};
}
function scanUSBRuntimes() { return async ({ dispatch, getState }) => { // do not re-scan if we are already doing it if (getState().ui.isScanningUsb) { return;
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung ist noch experimentell.