Question: Why do you want to emit a custom event?

Asked By
joelq
Asked At
2017-10-11 18:08:04

Found 15 possible answers.

User Answered At Possible Answer
jxxcarlson 2017-10-11 18:09:33 Anyone have pointers to downloading a string from Elm to the user’s computer?
joelq 2017-10-11 18:09:59 what do you mean by "downloading a string" ? well, probably this link: https://developer.mozilla.org/en-US/docs/Web/API/Storage/LocalStorage https://developer.mozilla.org/en-US/docs/Web/API/Window/localStorage If you don't want to download a file but instead just want to store data locally, you might want to look into localstorage Browsers don't have access to the user's file system. The best you can do is download a file to a user-defined folder (e.g. ~/Downloads )
jxxcarlson 2017-10-11 18:17:48 I’m really doing downloads. The string in question is the contents a LaTeX document an Elm+Phoenix app that the user might want to download to his/her computer to process there. The export code is in Elm front end, which is why it would be most convenient to do send the data directly from Elm rather than indirectly via Phoenix
joelq 2017-10-11 18:21:54 I've never tried to do that. Some ideas: 2. Port out to JS and use a JS API for saving 1. Create a data URI on an tag that has the download attribute set
jxxcarlson 2017-10-11 18:22:59 Great! I will give (1) a try for starters.
neerajsingh.miami 2017-10-11 20:29:52 Is if not allowed in let ? I'm getting an error. https://ellie-app.com/6wNQ7sghTa1/0
ilias 2017-10-11 20:30:32 it is, but not like that - let lets you assign things try something like let message = if condition then "a" else "b" in
neerajsingh.miami 2017-10-11 20:32:08 That worked.
joelq 2017-10-11 20:32:10 Think of if ... else as an _expression_ that returns a value rather than as a _statement_ that sets values In Elm, everything is return values :slightly_smiling_face:
neerajsingh.miami 2017-10-11 20:32:44 that makes sense thanks
thomasin 2017-10-11 20:38:44 Hello, is anyone available to talk about the type constructor problem I was having yesterday?
ilias 2017-10-11 20:39:48 I think I missed that - quick recap in TL;DR format?
thomasin 2017-10-11 20:42:25 I’m decoding JSON and it has 9 lists of records that all share 7 common properties and then 5 - 8 unique ones. I could write all the types out and copy paste those properties into each type but I want to learn how to do record extension w/ types
  }
  , id : Int
  , location_id : Maybe Int
  , source_id : String
  , part_site : Maybe String
  | comment : Maybe String
  { record
type alias BasicProperties record =
  }
  , name : String
  { items : List details
At the moment I have two that are:
type alias PropertyRecord details =
ilias 2017-10-11 20:43:53 Yeah, it seems attractive to think of extensible records as a sort of "class hierarchy"; and that doesn't work out that well
thomasin 2017-10-11 20:44:31 Ok! I will go back to my Copy pasting

Related Questions