[elm-discuss] Elm "missing library / I was blocked by ..." scoreboard?

2017-04-12 Thread Martin Janiczek
Would it be a good idea to create Elm "scoreboard" at canny.io or something 
similar? (See https://react-native.canny.io/feature-requests for example)

Seeing Twitter @elmlang mentions like: "It's sad that we lack touch 
subscription support on @elmlang", it seems to me that we could aggregate 
these on the canny.io page and in some time see what are the biggest pains 
(ie. touch events / web audio / window scroll subscriptions / ...)

On Slack it has been noted that GitHub issues could serve the same purpose, 
although it lacks the UI (sort by most wanted feature) and from the top of 
my head I don't know which repo would be good for that. 
elm-community/something?

-- 
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 elm-discuss+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[elm-discuss] Re: WYSIWYG functionality

2017-04-12 Thread Daniel Wehner
It could be really interesting to also experiment with looking 
at https://draftjs.org/ / providing a port or a in elm implementation of it.

https://github.com/thebritican/elm-editor seemed to have tried that, but 
there seemed no progress on that in the meantime.

Am Mittwoch, 12. April 2017 06:20:44 UTC+1 schrieb Michael Lebow:
>
> I'm working on something that requires some WYSIWYG editor like 
> functionality.
>
> The way I'm thinking about it is inspired by the Basecamp Trix editor and 
> the Medium editor.  Capture input events, create an internal model 
> representing the content, and then re-render.  (Avoiding execCommand and 
> the differences that can cause with different browsers)
>
> ContentEditable seems to be the only way to accomplish this.  A simple 
> input will not allow for some of the rich text features I plan to 
> implement. 
>
> I have started an implementation of this and get stuck with the problem of 
> needing to manually set the cursor position after text is typed and the 
> html re-renders.  (Currently, it jumps to the front of the content editable 
> div after every keystroke)  It looks like maybe at one point in time this 
> was a problem with simple text inputs in elm too??  (
> https://groups.google.com/forum/#!topic/elm-discuss/I2JleY8bD7c)  I'm 
> curios if anyone can direct me to the history of that bug and what the 
> solution was.
>
> This content editable cursor position issue is also brought up here: 
> https://github.com/elm-lang/virtual-dom/issues/23
>
>
> From my reading on this, it seems other's have brought up the idea of 
> making an WYSIWYG editor with Elm, but get stuck with the inability to do 
> things like window.getSelection() or interact with that selection e.g. 
> Selection.addRange()
> This is brought up here - 
> https://groups.google.com/forum/#!topic/elm-dev/169IJRJsW6Q - and 
> seemingly left unresolved.
>
> If I'm willing to do the legwork, what's the best way to accomplish this 
> in Elm?  If it's not currently possible with only Elm, what's the next best 
> thing?  Is there a way I can build the APIs that Elm currently lacks for my 
> own use until the community determines the best way to incorporate them 
> into Elm?  Should I be reaching for Ports?
>
> Thanks in advance!
>

-- 
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 elm-discuss+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[elm-discuss] Re: Call of init function behaviour

2017-04-12 Thread Nicholas Hollon
Glad you fixed your problem. If you give the button an onSubmit 
 
event handler, that should prevent the reload from happening, even if you 
are using Html.form.

On Tuesday, April 11, 2017 at 11:46:10 AM UTC-7, Oliver Dunkl wrote:
>
> Thank you for your reply. I have solved my problem after looking hours and 
> hours on my code :) The problem was that I had a button that calls to the 
> backend which I described in my question and the problem was that the 
> button was in a Html.form. Apparently it will first trigger the action and 
> than reloads the page and triggers the init function again.
>
> So Nicholas we had the right answer independently.
>
> Sorry for the noise but maybe I could help other people with the answer :)
>
> thx
> \= odi
>

-- 
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 elm-discuss+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[elm-discuss] Notify me when JWT expires

2017-04-12 Thread Kasey Speakman
I made this module yesterday to notify me when a JWT bearer token expires. 
Thought I would share in case anyone found useful, maybe make a package 
later.

https://gist.github.com/kspeakman/bd13d5b922a6abfcbb480a907161030c

Basic usage (ignoring JWT parse errors) is:

jwtString
|> Jwt.onExpired Logout
|> Result.withDefault Cmd.none

This should be run one time. I run either on program init (jwt loaded from 
local storage and passed in through flags) or when token is received on 
login. When the expiration time comes, it will send back whatever message 
you specify (e.g. Logout).

Our use cases currently don't have users repeatedly logging in/out or 
swapping logins, so I'm not dealing with canceling the expiration 
notification. If I needed to deal with this for now, I would probably just 
refresh the page on logout to kill the sleeping process (which is just 
Javascript's `setTimeout`). Or ignore notifications from old tokens (match 
token signature?).

I used a couple of internal functions from elm-jwt 
 for converting JWT back to proper 
Base64.

-- 
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 elm-discuss+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[elm-discuss] Re: Task ports: A proposal to make it easier to integrate JS with Elm.

2017-04-12 Thread Martin Norbäck Olivers
Yes, right now I want to make uuids by getting random numbers from 
window.crypto.getRandomValues. To generate good uuids without risk of 
collisions we need 128 bits of randomness, which the current random 
packages do not supply (they only supply 32, which is not enough).

It would be great to be able to do
port random : Int -> Task Never (List Int)

and in javascript do something like this:
app.ports.random.handle(function (n, callback) {
  var array = new Uint32Array(n);
  window.crypto.getRandomValues(array);
  callback(null, array);
});

Right now, I have to write a native function to make the task, or make two 
ports and subscribe and keep track of the random numbers somehow.

-- 
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 elm-discuss+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[elm-discuss] Re: Task ports: A proposal to make it easier to integrate JS with Elm.

2017-04-12 Thread John Kelly
Here's​ some context on this request / discussion: 
https://www.reddit.com/r/elm/comments/61trtm/hard_things_about_ports_as_task_in_elm/?ref=search_posts

-- 
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 elm-discuss+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.