#elixir-lang - 31 March 2019
« Back 1 day Forward 1 day »
[09:47:01] manveru: anyone here played with phoenix liveview and tried passing a list of ints in phx-value? it arrives as a binary in my handler but i actually need integers...
[09:48:18] manveru: do i have to make them a binary and parse the ints out instead? tried pattern matching like `<<x, y>>`, but that fails for the numbers 11, 12, 13
[14:12:15] manveru: my approach was doing something like `def handle_event("click", [x, y], socket) do`, then i saw in the error that it tried to match it like `"value" => <<15, 8>>`, so instead i matched on `<<x, y>>`, which worked... except for the numbers 11, 12, and 13 :)
[14:13:28] manveru: i assume elixir is trying to do some magic there to figure out if it's a list or bitstring, and tbh, i'm still not sure how it does that
[14:15:22] manveru: ideally `phx-value` would encode into some kind of AST, so type isn't lost during the transfer :D
[14:17:50] manveru: also, in case you're interested, here's how i handled mouseover/mouseout, would be nice if `closestPhxBinding` was exported somewhere https://www.irccloud.com/pastebin/aZhn8Doi/app.js
[14:19:04] lpil: A list of ints is valid iodata so without a static type system I don't think Elixir would know when it needs to encode it as a list of ints rather than as iodata
[14:27:00] manveru: lpil: i'm mostly wondering how this happened, i can't find a way to reproduce it in iex :(
[14:30:33] manveru: basically there must be some value that causes this to fail: `<<11,12>> = [11,12] |> List.to_string`
[15:50:29] hypercore: it's not as simple as 'npm install'ing it and then "import xyz from 'xyz'" in app.js is it?
[15:58:58] hypercore: lpil: pretty sure it does -> https://github.com/axios/axios/blob/master/dist/axios.js
[16:06:37] hypercore: lpil: hmm i get 'unexpected keyword: default' for the first import statement, and 'axios not defined' for the second
[16:11:58] hypercore: lpil: awesome, thanks! i think the problem was i was importing axios in app.js and expecting it to work in my component.js file (also imported in app.js)
[20:35:03] Dakora: howdy. i have a project with a dependency that calls modules in my project via a config value, however it's not able to find the module. is there something special i need to do to access parent project modules?
[20:39:34] Dakora: it doesn't seem to be a typo, and this somehow works for the dependency developer. https://gist.github.com/dabaer/f18207f237ec72fcff357b6222e1c2e5
[20:44:40] Dakora: no worries! special characters and capital in calls have to be wrapped before tapped
[20:44:47] linduxed: which, by the way, reminded me that this is not what i'm looking for: rem/2 is the function i'm looking for :-P