as a result, the use of navigation is not immediately obvious
let navigator = Navigation.singlePage App MainWin Login updateNavigation
let app = Program.applicationCore navigator.Navigate
Framework.RunApplication (navigator, app)
Anyway, it looks to me like implicit dependency.
But what if a bond for these types will be strong? For example
type ApplicationCore<'Model,'Nav,'Message> (initialModel, nav:INavigator<'Model, 'Nav, 'Message>, update, binding) =
member this.Navigation (msg : 'Nav) =
async {
do! Async.SwitchToContext syncContext
nav.Navigate this msg
} |> Async.Start
member __.Navigator : INavigator<'Model, 'Nav, 'Message> = nav
and INavigator<'Model, 'Nav, 'Message> =
abstract member Run : ApplicationCore<'Model,'Nav,'Message> -> (System.Threading.SynchronizationContext -> ObservableBindingSource<'Message>) -> unit
abstract member Navigate : ApplicationCore<'Model,'Nav,'Message> -> 'Nav -> unit
and with a bit change of RunApplication
[<AbstractClass;Sealed>]
type Framework =
/// Run an application given an Application generator, Window generator, and other required information
static member RunApplication<'Model,'Nav,'Message> (applicationInfo : Framework.ApplicationCore<'Model,'Nav,'Message>) =
Framework.Framework.runApplication (App.toApplicationSpecification applicationInfo.Navigator applicationInfo)
For now
ApplicationCore
andINavigator
have not explicit dependency. But constructor takes functionnavUpdate
(from INavigator) as a parameteras a result, the use of navigation is not immediately obvious
Anyway, it looks to me like implicit dependency.
But what if a bond for these types will be strong? For example
and with a bit change of RunApplication
then the example above could be rewritten as
which is slightly easier to perceive.
So, it's just a thought about navigation system.