2022-09-23 08:13:32 +00:00
|
|
|
import { toState } from '../redux/functions';
|
2018-07-11 09:42:43 +00:00
|
|
|
|
2022-09-23 08:13:32 +00:00
|
|
|
import { IStateful } from './types';
|
2018-07-11 09:42:43 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Gets the value of a specific React {@code Component} prop of the currently
|
|
|
|
* mounted {@link App}.
|
|
|
|
*
|
2022-09-23 08:13:32 +00:00
|
|
|
* @param {IStateful} stateful - The redux store or {@code getState}
|
2018-07-11 09:42:43 +00:00
|
|
|
* function.
|
|
|
|
* @param {string} propName - The name of the React {@code Component} prop of
|
|
|
|
* the currently mounted {@code App} to get.
|
2021-03-16 15:59:33 +00:00
|
|
|
* @returns {*} The value of the specified React {@code Component} prop of the
|
2018-07-11 09:42:43 +00:00
|
|
|
* currently mounted {@code App}.
|
|
|
|
*/
|
2022-09-23 08:13:32 +00:00
|
|
|
export function getAppProp(stateful: IStateful, propName: string) {
|
2018-07-11 09:42:43 +00:00
|
|
|
const state = toState(stateful)['features/base/app'];
|
|
|
|
|
|
|
|
if (state) {
|
|
|
|
const { app } = state;
|
|
|
|
|
|
|
|
if (app) {
|
|
|
|
return app.props[propName];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return undefined;
|
|
|
|
}
|