Verified Commit f15a64e0 authored by Camil Staps's avatar Camil Staps 🚀

Add closeWindow task

parent 41705537
......@@ -55,6 +55,8 @@ serveElectron ::
!(String ElectronProcess UniversalConnectionDetails -> Task Connection)
!*World -> *World
closeWindow :: Task ()
closeAllWindows :: Task ()
runInElectron :: !ElectronProcess !(JSVal *JSWorld -> *JSWorld) -> Task ()
......
......@@ -280,6 +280,24 @@ parseBaseOptions ["--electron-port":p:rest] electron_opts opts =
parseBaseOptions rest {ElectronOptions | electron_opts & port=toInt p} opts
parseBaseOptions cli electron_opts opts = (cli,electron_opts,opts)
closeWindow :: Task ()
closeWindow = updateInformation [UpdateUsing id (flip const) editor] ()
where
editor :: Editor ()
editor = leafEditorToEditor
{ LeafEditor
| genUI = withClientSideInit initUI genUI
, onEdit = onEdit
, onRefresh = onRefresh
, valueFromState = valueFromState
}
where
genUI attributes datapath mode vst = (Ok (ui UITextView, ()), vst)
onEdit datapath (_,()) st vst = (Ok (NoChange,st), vst)
onRefresh datapath st _ vst = (Ok (NoChange,st), vst)
valueFromState s = Just s
initUI me world = (jsWindow .# "close" .$! ()) world
closeAllWindows :: Task ()
closeAllWindows =
upd
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment