Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
    1cg
    @1cg
    hyperscript gives you a ton of flexibility around events and timing in a relatively terse but natural syntax
    1cg
    @1cg

    otoh, as I wrote on twitter:

    working on a programming language nobody wants based on a programming language nobody remembers for a world w/ too many programming languages already and economists still think rational choice theory holds up lmao

    Eugene Esca
    @scsmash3r
    :D Cause it is much fun
    Edouard
    @inouire_twitter
    Thanks @chg20 , can't wait to try it on my project, it could save me some visibility togglers written with data-xx attributes and a bit of custom js :)
    36864
    @36864
    I'm having some CORS trouble trying to get an example working on codepen/jsfiddle, will come back to this when I have more time. Basically, see the value-select example in the htmx docs, but use select2 on the first control.
    Marcus
    @marcus-at-localhost
    @36864 not sure what your problem is with CORS but using a proxy helps most of the time https://allorigins.win/
    1cg
    @1cg
    @36864 you are using the "change" event on select2? https://select2.org/programmatic-control/events
    i wonder if the DOM is getting hammered by the plugin and the default event isn't working the way one would expect...
    Ohhh, that might be it: if the DOM is reworked after htmx gets a crack at it, it might nuke the event handlers.
    there are a few possibilities
    @inouire_twitter I am going to be cranking on docs tonight (I have to do my day job today unfortunately) and tomorrow lets talk. You may be the first official user of hyperscript in the world. Brave man!
    Edouard
    @inouire_twitter
    cool !
    I'll try it out
    Edouard
    @inouire_twitter
    It does not work unless unless unsafe-eval in enabled in my CSPs :(
    Is it really mandatory ? (I guess it's for the "call" feature?)
    Another thing, do you plan to add a built-in visibility toggling feature? (That's what I use the most, nut I know I could do it with css classes)
    Thanks !
    1cg
    @1cg
    Unfortunately yes we transpile to JavaScript so it is necessary for now. Eventually I’d like to offer a command line tool to precompile everything but that’s a way off. Can you post the html in question and I can make sure there is a good solution for it?
    Seth Livingston
    @sethlivingston
    can i put an hx-post and hx-target on the outer form, and then add something to the select elements inside the form that just says, submit the form when you change?
    i could see how that's not an htmx concern
    <form>
      <select ... hx-post="/foo" hx-target="#data-table">
      ...
      <select ... hx-post="/foo" hx-target="#data-table">
    </form>
    i'm just trying to remove that duplication
    Seth Livingston
    @sethlivingston
    also, is there a way to throttle the posts and gets? so if the user make a quick change to the first AND second select, i'd like to combine them into a single post call
    1cg
    @1cg
    you can move the hx-target up
    and you can move the post up too, but you'll need to explicitly catch the "change" event on the form, since it will bubbling

    From twitter:

    Alright, happy to announce htmx 0.0.5:

    https://htmx.org/posts/2020-6-19-htmx-0.0.5-is-released/

    and the shiny, new and almost certainly completely broken hyperscript 0.0.1-alpha2:

    https://hyperscript.org

    And as luck would have it 0.0.5 shipped with a "throttle" modifier on the hx-trigger attribute.
    Looks like I didn't document it though :/
    it's like delay
    hx-trigger="changed throttle:100ms"
    1cg
    @1cg
    updated the docs for hx-trigger
    Seth Livingston
    @sethlivingston
    hahaha that's funny about the hx-trigger throttle. thank you!
    two great releases
    Cameron Elliott
    @cameronelliott
    Hello, I just discovered Intercooler/Htmx, and boy is it exciting! I am working on developing a site, but I am really a 99% backend guy.
    Two question: Should I be choosing Htmx at this point to get started?? Also, are there any articles/posts/etc on the different ways to setup authentication with Intercooler? ie: (auth0, jwt, something else??) Thanks a lot
    Cameron Elliott
    @cameronelliott
    Actually, maybe I should be asking what is the simplest way to put authentication in front of Intercooler/Htmx ?? That's really the big puzzling item for me at the moment.
    cscortes
    @cscortes
    @chg20 Just checking if I missed something, but what happened to handling localstorage variables as parameters?
    1cg
    @1cg
    @cscortes I didn't port that to htmx, not sure I am going to. Extension?
    @cameron-elliott I would just use whatever auth mechanism is standard for your preferred web framework
    Do authentication the "normal" way (no htmx) and then use htmx after the user is logged in.
    Once you have a session cookie it should be sent along with all ajax requests, so you can use the normal authentication mechanism of your server side framework
    Geoff Gallaway
    @geoffeg_twitter
    With htmx, is there some way to trigger an event from Javascript? I'm using a geolocation API, and I'd like to reload a part of the page from the server when the location becomes available.
    1cg
    @1cg
    @geoffeg_twitter you can add a custom trigger event to the element you want to refresh and then trigger it manually from javascript:
    <div id="map-data" hx-get="/some/url" hx-trigger="mapUpdated">
       ...
    </div>
    <script>
      htmx.trigger(htmx.find("#map-data"), "mapUpdated")
    </script>
    Where the javscript is fired in the callback from your geolocation API
    Geoff Gallaway
    @geoffeg_twitter
    Great, thanks!
    Cameron Elliott
    @cameronelliott
    @chg20 Thank you for the insight! I very excited about Htmx!
    1cg
    @1cg
    no prob, glad to help
    Alexander Graef
    @pzTV_twitter
    Just trying out htmx, as a big fan of intercooler. Is there an easy way to sync page titles and specific meta data, when using boost ? Thanks
    Alejandro Schmeichler
    @jreviews
    @chg20 Just wanted to quickly stop by and say thanks for all the work you and other volunteers are putting into this tool! Just tried the latest update to test how swapping an element with inputs with a copy of itself works, and even without morphdom, input focus is preserved! Very cool.
    1cg
    @1cg
    @pzTV_twitter We don't do anything with titles or metadata right now. I'm open to suggestions and/or extensions though.