Port Funnels
This is the interface to the JavaScript code for websockets and localStorage.
Your application needs to provide the actual ports, or simulators. See the example for details, and how to initialize the JavaScript code for the ports.
A Handler tags a function to handle responses from one funnel module.
Add a tag in this type for each funnel module you use.
Add a property to this type for each funnel module you use.
Turn the moduleName inside a GenericMessage into the output port.
getCmdPort tagger moduleName useSimulatortagger is the same Msg that processes input from the subscription port.
moduleName will be ignored if useSimulator is False.
Create a subscription for the subPort, given a Msg wrapper.
Create the initial state record.
Make a Dict mapping moduleName to tagged concrete FunnelSpec.
The Handler list is a list of all of your handlers. E.g. for this example, it would be:
makeFunnelDict
[ LocalStorageHandler localStorageHandler
]
getCmdPortWhere echoHandler and addXYHandler are functions in your main application module to handle responses.
Process a value coming in through the subPort.
The FunnelDict is the result of calling makeFunnelDict.
A
Dictthat maps a module name to a concretizedFunnelSpec.Create one with
makeFunnelDict. Pass it toprocessValue.