Appearance
onAppOpen
When an application is launched, developers can perform custom actions using the onAppClose hook.
Parameters
| Parameter | Type | Description |
|---|---|---|
| loadScript | function | See loadScript(fileName, scriptId) |
| loadStyle | function | See loadStyle(fileName, styleId) |
Return Value
None
✨ Simple Example of a onAppOpen Hook
js
((loadScript, loadStyle) => {
wpda.log.info("Starting products app...")
// Make sure path exists and is accessible:
loadScript("/path/my-js-functions.js", "myJsFunctions")
loadStyle("/path/my-style.css", "myCss")
})✨ Example Setting App Permissions Interactively
js
if (!userHasRole("manager")) {
app.setGlobalSearch(false)
app.setColumnFilters(false)
app.setInsert(false)
app.setUpdate(false)
app.setDelete(false)
app.setInlineEditing({
"email": false,
"first_name": true,
"last_name": true,
})
app.setBulkActions({
"pdf": true,
"xml": false,
"delete": false,
})
}