Files
pybricks-code/src/app/actions.ts
T
David Lechner 79d5b06136 editor: move isReady state from app
This is a step towards getting rid of the 'editor' context.
2022-03-26 12:03:08 -05:00

51 lines
1.6 KiB
TypeScript

// SPDX-License-Identifier: MIT
// Copyright (c) 2020-2022 The Pybricks Authors
//
// Actions for the app in general.
import { createAction } from '../actions';
/** Action that requests the app to reload. */
export const appReload = createAction(() => ({
type: 'app.action.reload',
}));
/* Action that requests to check for updates. */
export const appCheckForUpdate = createAction(() => ({
type: 'app.action.checkForUpdate',
}));
/** Action that indicates that checking for an update has completed. */
export const appDidCheckForUpdate = createAction((updateFound: boolean) => ({
type: 'app.action.didCheckForUpdate',
updateFound,
}));
/* Action that indicates the browser wants to prompt the use to install the app. */
export const appDidReceiveBeforeInstallPrompt = createAction(() => ({
type: 'app.action.didBeforeInstallPrompt',
}));
/* Action that requests to prompt the user to install the app. */
export const appShowInstallPrompt = createAction(() => ({
type: 'app.action.showInstallPrompt',
}));
/* Action that indicates that the user responded to the install prompt. */
export const appDidResolveInstallPrompt = createAction(
(result: { outcome: 'accepted' | 'dismissed'; platform: string }) => ({
type: 'app.action.didResolveInstallPrompt',
result,
}),
);
/* Action that indicates app was installed. */
export const didInstall = createAction(() => ({
type: 'app.action.didInstall',
}));
/** Creates an action that indicates the app has just started. */
export const didStart = createAction(() => ({
type: 'app.action.didStart',
}));