This library tries to address the following issues in building
View is the wrapper function that maps the original application's view function to new type. It also adds the default undo/redo/reset control buttons to the UI.
Update is a wrapper function which adds undo,redo,reset to an updater. This function also logs the action and the newState via sharing it over the port. The function takes logger, port for analytics, original update function, freshStateSetter, undoCount, undoListCommands. The function returns a new partial function which replaces the original update in your application's main function
The details about the arguements
NOTE : Last three parameters are of Maybe type so you can pass Nothing if you don't wish to use them.
Subscriptions is a wrapper function that maps the original application's subscriptions to the new types.
A very basic example which should suit most basic cases
-- import the package into your app and update the main function with the following
Browser.element
{ init = Core.init identity analyticsPort init
, view = Core.view view
, update = Core.update identity analyticsPort update setFresh Nothing Nothing
, subscriptions = Core.subscriptions subscriptions
} For using advanced features visit the Readme.md file.
The library does not support Browser.Document and Browser.Application since it was not required in the present usecase.
Init is a wrapper function that maps the original application's init function to new types It also logs the init action