halogen

Automatically focus input element after creation in purescript-halogen

∥☆過路亽.° 提交于 2019-12-24 05:13:05
问题 I'm using purescript-halogen to build a spreadsheet-like table (similar to Handsontable). If you double-click a cell, an html input element is rendered as a child of the respective table cell (and no such element is rendered for all the other cells). This works really well with halogen, except that I don't know how to automatically set the focus to the newly created input element. I tried the autofocus attribute, but this only works for the first cell that is double-clicked. The JavaScript

Purescript Halogen, side effect (random number)

ぃ、小莉子 提交于 2019-12-11 04:46:15
问题 In a PureScript Halogen project, I would like to set the state to a random number, but how do I extract the value? The normal r <- randomInt 1 10 does not compile when it's inside the eval function. module Main where import Prelude import Control.Monad.Eff (Eff) import Control.Monad.Eff.Random (randomInt, RANDOM) import Halogen as H import Halogen.HTML.Events.Indexed as HE import Halogen.HTML.Indexed as HH import Halogen.Util (runHalogenAff, awaitBody) type State = { n::Int } initialState ::

Halogen keyboard-input example and unsubsribing to the events?

人走茶凉 提交于 2019-12-11 04:39:14
问题 How to unsubscribe to keyboard events from other actions than HandleKey in the keyboard-input example? (The question is related to Halogen version 2.0.1 and purescript 0.11.4.) In the example the enter/return works. I have a group of elements that can be collapsed with mouse by pressing close-button and Close-action takes care of it. Also, the enter/return can be used to collapse the elements and it works as it should. Open next -> do st <- H.get if not st.open then do H.modify (_ { open =

Purescript: Halogen HTML DSL only Renders “id” tags

早过忘川 提交于 2019-12-11 00:54:34
问题 I'm using purescript-halogen v0.12.0 , and I can't figure out why only the id tag is rendering. This occurs even with supposedly well supported elements, like div . Example: render = div [ id_ "some-id", name "some-name ] [] A div will be created, but only with an id attribute. This occurs with elements in Halogen.HTML as well as Halogen.HTML.Indexed . Any help in the right direction would be appreciated. ============================================================= Reproduce the issue with

PureScript Halogen and websockets

偶尔善良 提交于 2019-12-04 05:54:40
I'm trying to use purescript-halogen in combination with websockets, but after several attempts I'm unable to make them work together. I've seen this question on Thermite and websockets and Phil's answer regarding the Driver function. Halogen also has a Driver function, but I need to run the Driver function with the Aff effect, while purescript-websockets-simple uses the Eff effect. I've no idea how to transform the synchronous callbacks of the websocket package to asynchronous code running in the Aff monad. Do I need to use an AVar ? Do I need purescript-coroutines-aff ? If so, how do I hook