Verified Commit 63b7c411 authored by Camil Staps's avatar Camil Staps 🚀

Allow for extra StartableTasks at startup, to be able to add onRequest taasks

parent adee8cc5
......@@ -5,7 +5,7 @@ from ABC.Interpreter.JavaScript import :: JSVal, :: JSFun, :: JSWorld
from ABC.Interpreter.JavaScript.Monad import :: JS
from Data.GenEq import generic gEq
from Text.GenJSON import :: JSONNode, generic JSONEncode, generic JSONDecode
from iTasks.Engine import :: EngineOptions
from iTasks.Engine import :: EngineOptions, :: StartableTask
from iTasks.Internal.Generic.Visualization import :: TextFormat, generic gText
from iTasks.SDS.Definition import :: SimpleSDSLens, :: SDSLens,
class Identifiable, class Readable, class Registrable
......@@ -51,7 +51,7 @@ derive JSONDecode TransportMethod
tcpQueueEmpty :: SimpleSDSLens Bool
serveElectron ::
!([String] ElectronOptions EngineOptions -> (ElectronOptions, EngineOptions))
!([String] ElectronOptions EngineOptions -> (ElectronOptions, EngineOptions, [StartableTask]))
!(String ElectronProcess UniversalConnectionDetails -> Task Connection)
!*World -> *World
......
......@@ -123,7 +123,7 @@ tcpConnections :: SimpleSDSLens (Map ElectronProcess Connection)
tcpConnections =: sdsFocus "tcpConnections" (memoryStore "Electron" (Just 'Data.Map'.newMap))
serveElectron ::
!([String] ElectronOptions EngineOptions -> (ElectronOptions, EngineOptions))
!([String] ElectronOptions EngineOptions -> (ElectronOptions, EngineOptions, [StartableTask]))
!(String ElectronProcess UniversalConnectionDetails -> Task Connection)
!*World -> *World
serveElectron modOpts startConnection w = doTasksWithOptions
......@@ -133,11 +133,11 @@ serveElectron modOpts startConnection w = doTasksWithOptions
, debug = False
}
# (cli,electron_opts,opts) = parseBaseOptions (tl cli) electron_opts opts
# (electron_opts,opts) = modOpts cli electron_opts opts
# (electron_opts,opts,startup) = modOpts cli electron_opts opts
# main = onStartup (task electron_opts.ElectronOptions.port)
| electron_opts.debug
-> Ok ([main, onRequest "/debug" showDebugInfo], opts)
-> Ok ([main], opts))
-> Ok (startup ++ [main, onRequest "/debug" showDebugInfo], opts)
-> Ok (startup ++ [main], opts))
w
where
task :: !Int -> Task ()
......
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