https://htmx.org logo
Join Discord
Powered by
# htmx-general
  • m

    mysterious-toddler-20573

    12/26/2020, 8:12 PM
    still need to think more
  • m

    mysterious-toddler-20573

    12/26/2020, 8:13 PM
    maybe the right thing is to introduce a
    queue
    modifier to the trigger, and then default it depending on the element type: buttons and links don't queue, other things do.
  • m

    mysterious-toddler-20573

    12/26/2020, 8:15 PM
    the
    disable
    and
    caret
    problems are tough. Still thinking...
  • g

    gorgeous-ghost-95789

    12/26/2020, 8:16 PM
    So, you're already well ahead of me in thinking about this.
  • g

    gorgeous-ghost-95789

    12/26/2020, 8:17 PM
    I'll add that many websites will style things like
    a
    and
    span
    to look like buttons. So, making those rules based on element type might be a problem for them. (That's not necessarily a bad thing.. just forcing them to be more symantic)
  • m

    mysterious-toddler-20573

    12/26/2020, 8:18 PM
    they can always access the setting by being explicit
  • m

    mysterious-toddler-20573

    12/26/2020, 8:19 PM
    this also reminds me of a feature I want to add to hyperscript where you can say:
    Copy code
    js
      while some expression <some reversable operation>
  • m

    mysterious-toddler-20573

    12/26/2020, 8:19 PM
    e.g.
  • m

    mysterious-toddler-20573

    12/26/2020, 8:19 PM
    Copy code
    js
      while .htmx-request add .foo to me
  • m

    mysterious-toddler-20573

    12/26/2020, 8:20 PM
    And use observers to make that all work
  • m

    mysterious-toddler-20573

    12/26/2020, 8:20 PM
    OK, family time... think more kids
  • a

    adamant-exabyte-92636

    12/26/2020, 10:41 PM
    I had a stab at extending the path-deps extension. I logged a ticket (https://github.com/bigskysoftware/htmx/issues/286) and created a pull request (https://github.com/bigskysoftware/htmx/pull/287). Could you please have a look when you have time and comment on it? If you think its ok I'll add the tests and documentation
  • r

    rough-judge-5566

    12/27/2020, 12:38 AM
    Is there a tl;dr of how to dynamically populate an element with json websocket data?
  • m

    mysterious-toddler-20573

    12/27/2020, 2:34 AM
    not that I'm aware
  • m

    mysterious-toddler-20573

    12/27/2020, 2:34 AM
    Thank you, I will try to look at this tomorrow!
  • r

    rough-judge-5566

    12/27/2020, 2:34 AM
    Ah I'll hold off on htmx a bit then
  • m

    mysterious-toddler-20573

    12/27/2020, 2:35 AM
    @User yes, I think that's probably the smart play. The websocket stuff is relatively new.
  • m

    mysterious-toddler-20573

    12/27/2020, 2:35 AM
    If you are willing to work with it a bit, you could probably contribute there
  • m

    mysterious-toddler-20573

    12/27/2020, 2:35 AM
    but that is a commitment
  • m

    mysterious-toddler-20573

    12/27/2020, 2:37 AM
    yeah, ok, looking at the web socket code, we do give you a crack at transforming the JSON before it is processed:
  • m

    mysterious-toddler-20573

    12/27/2020, 2:37 AM
    https://github.com/bigskysoftware/htmx/blob/5fd24a7096a0ecba6478fd6a06de1e321b65aab9/src/htmx.js#L1015
  • m

    mysterious-toddler-20573

    12/27/2020, 2:39 AM
    So you could write an extension to transform the JSON into HTML on the client side
  • m

    mysterious-toddler-20573

    12/27/2020, 2:39 AM
    however, if the data is coming down in JSON, the advantages of running it through htmx seem attenuated
  • m

    mysterious-toddler-20573

    12/27/2020, 2:40 AM
    I guess there is the nicety that you can target elements by ID w/ the stream, and you get the OOB swapping behavior, so that might be useful
  • a

    adamant-exabyte-92636

    12/27/2020, 1:28 PM
    Another Intercooler -> htmx question: is there a htmx equivalent for
    ic-trigger-from
    ?
  • m

    mysterious-toddler-20573

    12/27/2020, 2:50 PM
    the solution here would be hyperscript, and triggering an event on the intended target:
    Copy code
    html
      <div _"on click trigger makeRequest on #otherDiv>...</div>
    
      <div id="otherDiv" hx-trigger="makeRequest" hx-get="/whatever">...</div>
  • m

    mysterious-toddler-20573

    12/27/2020, 2:51 PM
    would you mind starting to collect all these things into a markdown file so we can publish an intercooler -> htmx porting guide?
  • a

    adamant-exabyte-92636

    12/27/2020, 2:51 PM
    ๐Ÿ˜‚ thatโ€™s exactly what I was thinking
  • a

    adamant-exabyte-92636

    12/27/2020, 2:53 PM
    Sure. Iโ€™m going to be porting an existing app from intercooler to htmx and was going to be documenting my findings anyway. I would be thrilled if it could help other folks as well ๐Ÿ˜Š
  • m

    mysterious-toddler-20573

    12/27/2020, 2:57 PM
    alternatives you could use the javascript api:
1...112113114...1146Latest