On Wed, Dec 28, 2016 at 9:06 AM, Mark Hamburg <[email protected]> wrote:
> Just to make it clear, I'm not particularly calling for an easier way to > create "subscriptions". I'm calling for a way to do one of the following — > either is fine, each have their pluses and minuses: > > 1. Expose a synchronous, externally defined function that takes JSON (or > really anything a command port supports) in and returns JSON (or really > anything a subscription port supports) out. > - or - > 2. Expose a factory for externally defined asynchronous tasks where the > task when executed receives JSON (etc) in and resolves to JSON (etc) when > finished. > 1. would break the purity guarantee. 2. this looks like the mechanism for scheduling messages. In short, if one could schedule a message to be delivered after the execution of some JS function, one could accomplish what you want. I'm not familiar with how difficult would be to expose this functionality in the ports world. The functionality exists in the Native layer as one can see in the Native implementation of Time.now but exposing it in a safe and easy way through the ports API might not be trivial. -- There is NO FATE, we are the creators. blog: http://damoc.ro/ -- You received this message because you are subscribed to the Google Groups "Elm Discuss" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
