mirror of
https://github.com/nasa/openmct.git
synced 2025-01-01 19:06:40 +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) {
|
getStatusForMissionAction(action) {
|
||||||
const provider = this.#userAPI.getProvider();
|
const provider = this.#userAPI.getProvider();
|
||||||
|
|
||||||
@ -127,8 +132,8 @@ export default class StatusAPI extends EventEmitter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Fetch the list of possible mission status options
|
* Fetch the list of possible mission status options (GO, NO-GO, etc.)
|
||||||
* @returns {Promise<MissionStatusOption[]>} the current mission status
|
* @returns {Promise<MissionStatusOption[]>} the complete list of possible mission statuses
|
||||||
*/
|
*/
|
||||||
async getPossibleMissionActionStatuses() {
|
async getPossibleMissionActionStatuses() {
|
||||||
const provider = this.#userAPI.getProvider();
|
const provider = this.#userAPI.getProvider();
|
||||||
@ -144,7 +149,7 @@ export default class StatusAPI extends EventEmitter {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Fetch the list of possible mission actions
|
* 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() {
|
async getPossibleMissionActions() {
|
||||||
const provider = this.#userAPI.getProvider();
|
const provider = this.#userAPI.getProvider();
|
||||||
@ -347,9 +352,11 @@ export default class StatusAPI extends EventEmitter {
|
|||||||
/**
|
/**
|
||||||
* @typedef {import('./UserProvider')} UserProvider
|
* @typedef {import('./UserProvider')} UserProvider
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @typedef {import('./StatusUserProvider')} StatusUserProvider
|
* @typedef {import('./StatusUserProvider')} StatusUserProvider
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The PollQuestion type
|
* The PollQuestion type
|
||||||
* @typedef {Object} PollQuestion
|
* @typedef {Object} PollQuestion
|
||||||
|
@ -25,6 +25,12 @@ import { onBeforeUnmount, reactive } from 'vue';
|
|||||||
import throttle from '../../utils/throttle.js';
|
import throttle from '../../utils/throttle.js';
|
||||||
import { useEventListener } from './event.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() {
|
export function useResizeObserver() {
|
||||||
const size = reactive({ width: 0, height: 0 });
|
const size = reactive({ width: 0, height: 0 });
|
||||||
let observer;
|
let observer;
|
||||||
@ -54,13 +60,19 @@ export function useResizeObserver() {
|
|||||||
return { size, startObserving };
|
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 windowSize = reactive({ width: window.innerWidth, height: window.innerHeight });
|
||||||
|
|
||||||
const handleResize = throttle(() => {
|
const handleResize = throttle(() => {
|
||||||
windowSize.width = window.innerWidth;
|
windowSize.width = window.innerWidth;
|
||||||
windowSize.height = window.innerHeight;
|
windowSize.height = window.innerHeight;
|
||||||
}, 100);
|
}, throttleMs);
|
||||||
|
|
||||||
useEventListener(window, 'resize', handleResize);
|
useEventListener(window, 'resize', handleResize);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user