Skip to content

Add exit script #24

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion src/extensions/scriptor/ScriptorRunner.vue
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
id="dialog-delete"
:open="state.opened"
:label="current['rel']['name']"
@sl-after-hide="state.opened=false"
@sl-after-hide="exitScriptor"
>
<div class="wrapper-widgets" ref="messagewrapper">
<status-bar :id="state.id" :filename="current['dest']['name']"></status-bar>
Expand Down Expand Up @@ -112,6 +112,11 @@ const messagewrapper = ref(null)
state.opened = true
scriptorAction.value.executeScript(props.scriptParams)
}
function exitScriptor()
{
state.opened = false
scriptorAction.value.exitScript()
}

watch(
() => state.scriptor?.messages.length,
Expand Down
6 changes: 5 additions & 1 deletion src/extensions/scriptor/components/Status.vue
Original file line number Diff line number Diff line change
Expand Up @@ -45,15 +45,19 @@ const state = reactive({
async function executeScript(scriptParams) {
await scriptorStore.execute(state.scriptor.scriptCode, props.id,{},scriptParams)
}
async function exitScript()
{
await scriptorStore.exitScript()

}
function reset() {
scriptorStore.state.instances[props.id].messages = []
scriptorStore.state.instances[props.id].internalMessages = []
scriptorStore.state.isReady = false
}

defineExpose({
reset, executeScript,state
reset, executeScript,exitScript,state
})


Expand Down
6 changes: 6 additions & 0 deletions src/extensions/scriptor/store/scriptor.js
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,11 @@ export const useScriptorStore = defineStore("scriptorStore", () => {
}
}

async function exitScript()
{
sendResult("exit","__exit__")
}

async function execute(code, id = null, context = {},scriptParams={}) {
let currentId = createNewInstance(id) // create needed Instance Object
state.currentInstance = currentId
Expand Down Expand Up @@ -330,6 +335,7 @@ export const useScriptorStore = defineStore("scriptorStore", () => {
state,
progress,
execute,
exitScript,
sendResult,
createNewInstance,
fetchScriptorVersions
Expand Down