mirror of
https://github.com/nasa/openmct.git
synced 2024-12-20 05:37:53 +00:00
docs: add documentation
This commit is contained in:
parent
e720796285
commit
b44a5b21c0
@ -116,6 +116,11 @@ export default class StatusAPI extends EventEmitter {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Fetch the current status for the given mission action
|
||||
* @param {MissionAction} action
|
||||
* @returns {string}
|
||||
*/
|
||||
getStatusForMissionAction(action) {
|
||||
const provider = this.#userAPI.getProvider();
|
||||
|
||||
@ -127,8 +132,8 @@ export default class StatusAPI extends EventEmitter {
|
||||
}
|
||||
|
||||
/**
|
||||
* Fetch the list of possible mission status options
|
||||
* @returns {Promise<MissionStatusOption[]>} the current mission status
|
||||
* Fetch the list of possible mission status options (GO, NO-GO, etc.)
|
||||
* @returns {Promise<MissionStatusOption[]>} the complete list of possible mission statuses
|
||||
*/
|
||||
async getPossibleMissionActionStatuses() {
|
||||
const provider = this.#userAPI.getProvider();
|
||||
@ -144,7 +149,7 @@ export default class StatusAPI extends EventEmitter {
|
||||
|
||||
/**
|
||||
* Fetch the list of possible mission actions
|
||||
* @returns {Promise<MissionAction[]>} the list of possible mission actions
|
||||
* @returns {Promise<string[]>} the list of possible mission actions
|
||||
*/
|
||||
async getPossibleMissionActions() {
|
||||
const provider = this.#userAPI.getProvider();
|
||||
@ -347,9 +352,11 @@ export default class StatusAPI extends EventEmitter {
|
||||
/**
|
||||
* @typedef {import('./UserProvider')} UserProvider
|
||||
*/
|
||||
|
||||
/**
|
||||
* @typedef {import('./StatusUserProvider')} StatusUserProvider
|
||||
*/
|
||||
|
||||
/**
|
||||
* The PollQuestion type
|
||||
* @typedef {Object} PollQuestion
|
||||
|
@ -25,6 +25,12 @@ import { onBeforeUnmount, reactive } from 'vue';
|
||||
import throttle from '../../utils/throttle.js';
|
||||
import { useEventListener } from './event.js';
|
||||
|
||||
/**
|
||||
* A composable which provides a function to begin observing the size of the passed-in element,
|
||||
* and a reactive object containing the width and height of the observed element. The ResizeObserver
|
||||
* is automatically disconnected before the component is unmounted.
|
||||
* @returns {{size: {width: number, height: number}, startObserving: (element: HTMLElement) => void}}
|
||||
*/
|
||||
export function useResizeObserver() {
|
||||
const size = reactive({ width: 0, height: 0 });
|
||||
let observer;
|
||||
@ -54,13 +60,19 @@ export function useResizeObserver() {
|
||||
return { size, startObserving };
|
||||
}
|
||||
|
||||
export function useWindowResize() {
|
||||
/**
|
||||
* A composable function which can be used to listen to and handle window resize events.
|
||||
* Throttles the resize event to prevent performance issues.
|
||||
* @param {number} [throttleMs=100] The number of milliseconds to throttle the resize event.
|
||||
* @returns {Ref<{ width: number, height: number }>} windowSize
|
||||
*/
|
||||
export function useWindowResize(throttleMs = 100) {
|
||||
const windowSize = reactive({ width: window.innerWidth, height: window.innerHeight });
|
||||
|
||||
const handleResize = throttle(() => {
|
||||
windowSize.width = window.innerWidth;
|
||||
windowSize.height = window.innerHeight;
|
||||
}, 100);
|
||||
}, throttleMs);
|
||||
|
||||
useEventListener(window, 'resize', handleResize);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user