by

Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
    ImaginaryDevelopment
    @ImaginaryDevelopment
    if I have a Cmd<foo> and I want to introduce another Cmd<foo> with a delay (I'm going to do the thing once on startup, then on each update pass back a cmd saying do it again in 1000<ms> or something. I don't see an Async.AwaitCmd. and I suppose I wouldn't since starting a command requires a dispatcher. do I need to refactor the work out to an async instead of a command?
    Maxime Mangel
    @MangelMaxime

    I am not sure if we released subscription supporting this case in Elmish yet.

    Or you can try using a custom command? Or have a look at Thoth.Debouncer https://thoth-org.github.io/Thoth.Elmish.Debouncer/.

    I am not sure this will solve your problem, but better than nothing

    ImaginaryDevelopment
    @ImaginaryDevelopment
    will Async.Sleep x work?
    ImaginaryDevelopment
    @ImaginaryDevelopment
    I figured it out as changing the original command
            let getAlarmsCmd selectedClients getUser sleepOpt =
                let getAlarms (selectedClients: DTO.Client []) accessToken: JS.Promise<DbTypes.Alarm list> =
                    promise {
                        match sleepOpt with
                        | Some delay ->
                            do! Promise.sleep delay
                        | None -> ()
                   // other code omitted
    Cody Johnson
    @Shmew
    @MangelMaxime do you happen to know how I can avoid the Emit attribute from using null in the output when coming from a method with optional parameters?
    nvm I found that I can use ...
    Andreas Vilinski
    @vilinski

    I'm tried out Fable.Remoting. It works very well.
    But now I need to push an event from the server - a result of a long operation. Is it possible with Fable.Remoting?

    Or I thougth to add additionally something like this https://github.com/CompositionalIT/safe-sockets/blob/master/src/Server/Server.fs#L50-57
    But don't know how to add another route to the saturn's webApp, where I have only remoting stuff like Remoting.createApi() etc

    Cody Johnson
    @Shmew
    You need web sockets to be able to push to the client
    Only way to get something like that without it is to do polling
    that I'm aware of
    Steffen Forkmann
    @forki
    @MangelMaxime hey buddy, hope you are doing well. quick question. https://creativebulma.net/product/calendar/demo shows datetimepicker.
    Maxime Mangel
    @MangelMaxime

    Hello @forki yes I am fine thank you. And you?

    No, it doesn't because it was not existing at the time and also because of this a JavaScript component which would result of it being out of Elmish control. I am not a fan of that.

    If you want to use the shown component, you will have to wrap it in a react stateful component.

    And as you see Fulma.Calendar stopped at version 0.1.7 of the npm library and I believe now it's version 6 something. He made a lot of breaking change in it and don't expect people to use the raw CSS version anymore as it's not documented anymore...
    Steffen Forkmann
    @forki
    yes I'm fine.
    ok then let me rephrase: do you know a nice datetime picker?
    tried react-datetime-picker but
    image.png
    Andreas Vilinski
    @vilinski

    You need web sockets to be able to push to the client

    yes, but should I abandon the Fable.Remoting then or is it possible to use both?

    Alf Kåre Lefdal
    @aklefdal
    How do I set the the Title of the page when using routing? The title that is visible in the tab in the browser, and being used as title when sharing a link.
    Cody Johnson
    @Shmew
    @vilinski that largely depends on your use cases, how important is it to have real-time data? I would just google "Websockets vs REST" and read some articles about the pros and cons of each
    @aklefdal I believe you can use document.title <- "my new title"
    Maxime Mangel
    @MangelMaxime
    @forki No I don't know any good ones. I am creating my own.
    Cody Johnson
    @Shmew
    I have a picker library but it's for material-ui
    Andreas Vilinski
    @vilinski
    @Shmew I know what the difference, I just need to know how to do it with fable or saturn if I already have Fable.Remoting.
    can I use Fable.Remoting together with saturn channels?
    Cody Johnson
    @Shmew
    you can use them together sure, but if you're using websockets for every user then the pros of a rest api drops quite a bit
    I haven't used saturn channels, but Elmish.Bridge works quite nicely
    Andreas Vilinski
    @vilinski
    I'm writing internal tool, so there are at most a few simultaneous users. Each of them can start an operation and make others, who has currently opened the page, aware of this. If it works out I will also push some server logs to them
    Alf Kåre Lefdal
    @aklefdal
    Thanks, @Shmew, I will try it out.
    Damian Reeves
    @DamianReeves
    Hi… is there an example/template that cross compiles an F# Library to Fable and .NET core?
    Cody Johnson
    @Shmew
    any of Zaid's libraries are pretty good examples
    Damian Reeves
    @DamianReeves
    So if I understand correctly, the key bit is to package the source in the fable\ folder of the nuget package:
        <ItemGroup>
            <Content Include="*.fsproj; *.fs" PackagePath="fable\" />
        </ItemGroup>
    Cody Johnson
    @Shmew
    yes, it's important that fable has access to the source files
    Damian Reeves
    @DamianReeves
    So does that mean the same nuget package can host .NET Core and fable assets?
    Cody Johnson
    @Shmew
    correct
    FSharpPlus works in both dotnet and fable for example
    Damian Reeves
    @DamianReeves
    thanks
    Alkasai
    @Alkasai

    I'm trying to work with dates, but no matter what I try, the UTC <> Local conversion doesn't work.
    For example both of these return the same string...

    DateTime.Now.ToLongTimeString()
    DateTime.UtcNow.ToLongTimeString()

    Anyone know how to properly convert dates between UTC and Local?

    Steffen Forkmann
    @forki
    I am creating my own. @MangelMaxime - I'm listening! ;-)
    Eugene Tolmachev
    @et1975
    @ImaginaryDevelopment here's a delay Cmd:
    module Cmd =
        open Browser
        open Elmish
        let delay (time:System.TimeSpan) cmd : Cmd<_> =
            let invoke dispatch =
                cmd |> List.iter (fun f -> f dispatch)
            [ fun dispatch -> 
                window.setTimeout(invoke, (int time.TotalMilliseconds), dispatch) |> ignore ]
    ImaginaryDevelopment
    @ImaginaryDevelopment
    Why would I use that over async.sleep?
    Maxime Mangel
    @MangelMaxime

    @ImaginaryDevelopment setTimeout is a native API and so will not include more code.

    async as known in F# doesn't exist in JavaScript so we creating our own implementation.

    Both will work it's probably a matter of preference I think. In general, I am in favor of the native API
    Cody Johnson
    @Shmew
    Hey @MangelMaxime do you know if there is a way to get fable-splitter to move js source files to the output along with the newly compiled fs -> js files?
    doesn't appear it cares if you set Compile Include in the fsproj
    I already have allFiles: true in my splitter.config.js
    Maxime Mangel
    @MangelMaxime
    You can force it by adding importSideEffect or something like that.
    I think