Optional
currentOptional
currentReadonly
historyThe shell's history for the main view.
const store = useAppRootStore()
store.history.pushState({ query: 'site and geoCity == "Brighton and Hove"' })
Readonly
historyThe shell's history for the sidebar view.
const store = useAppRootStore()
store.history.pushState({ query: 'site and geoCity == "Brighton and Hove"' })
The current loaded project.
Setting this will change the project currently being used.
const store = useAppRootStore()
console.log(`The project name is ${store.project}`)
// Select a different project...
store.project = 'foo'
A boolean flag used to toggle whether the sidebar is open or not.
Changing this will toggle whether the sidebar is showing or not.
const store = useAppRootStore()
if (store.sidebarOpen) {
...
}
// Close the sidebar...
store.sidebarOpen = false
The current context's target. An empty string means no target is currently selected.
Changing this will also change the target.
const store = useAppRootStore()
console.log(`The current target is ${store.target}`)
// Change the target...
const ref = HRef.make('p:foo:sometarget')
store.target = ref.value
The current context's target for the sidebar. An empty string means the sidebar's target will fallback to the main target.
Changing this will also change the target for the sidebar.
console.log(The current target is ${store.targetSidebar}
)
// Change the target for the sidebar... const ref = HRef.make('p:foo:sometarget') store.targetSidebar = ref.value
All the locales available to use.
const store = useAppRootStore()
console.log(`All the supported locales are ${store.allLocales}`)
The record for for the currently logged in user.
The current locale being used.
const store = useAppRootStore()
console.log(`The current user's locale is ${store.locale}`)
The current sidebar application being rendered by the shell or undefined if there is no sidebar application view loaded.
Post a message to the system. The message will be received via an application's onMessage callback. Please note, an application also needs to declare the messages its interested in via messages.
const store = useAppRootStore()
store.postAppMessage('newMessage', { data: 'some data' })
Register quicklinks for the current application view.
This is typically called in the main application's first render call...
...
render(props: AppProps) {
const store = useAppRootStore()
useEffect(() => {
store.registerQuicklinks({
foo: {
icon(): JSX.Element { return <MyIcon /> },
invoke() { console.log('Invoked quicklink') }
}
})
}, [])
...
}
Register dynamic sidebar application views. This is used to dynamically add temporary sidebar application views at runtime. These sidebar views are registered from a main application view. They are only available whilst the the current main application view is open.
...
render(props: AppProps) {
const store = useAppRootStore()
useEffect(() => {
store.registerSidebars({
myDynamicSidebar: {
icon(): JSX.Element { return <MyIcon /> },
render(): JSXElement { return <Foo /> }
}
})
}, [])
...
}
Unregister quicklinks for the current application view.
Please note, quicklinks are automatically unregistered when the current application view unloads.
```
...
const quicklinks = {
foo: {
icon(): JSX.Element { return
@param quicklinks The quicklinks to remove.
Unregister sidebars for an application. Only dynamic sidebars that were previously added via registerSidebars will be unregistered.
Please note, all dynamic sidebars are automatically unregistered when the current application view unloads.
...
const sidebars = {
myDynamicSidebar: {
icon(): JSX.Element { return <MyIcon /> },
render(): JSXElement { return <Foo /> }
}
}
...
render(props: AppProps) {
const store = useAppRootStore()
useEffect(() => {
store.registerSidebars(sidebars)
}, [])
...
<Button onClick={() => store.unregisterSidebars(sidebars)}>Remove sidebars</Button>
}
Generated using TypeDoc
A simple application root store used for development/testing purposes.