Salta al contenuto
0
  • Home
  • Piero Bosio
  • Blog
  • Mondo
  • Fediverso
  • News
  • Categorie
  • Old Web Site
  • Recenti
  • Popolare
  • Tag
  • Utenti
  • Home
  • Piero Bosio
  • Blog
  • Mondo
  • Fediverso
  • News
  • Categorie
  • Old Web Site
  • Recenti
  • Popolare
  • Tag
  • Utenti
Skin
  • Chiaro
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Scuro
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Predefinito (Cerulean)
  • Nessuna skin
Collassa

Piero Bosio Social Web Site Personale Logo Fediverso

Social Forum federato con il resto del mondo. Non contano le istanze, contano le persone
  1. Home
  2. Categorie
  3. General Discussion
  4. The more I work on #ONI, which is basically a web components frontend for an as basic as possible #ActivityPub client to server service, the more I realize I'm just not built for JavaScript programming.

The more I work on #ONI, which is basically a web components frontend for an as basic as possible #ActivityPub client to server service, the more I realize I'm just not built for JavaScript programming.

Pianificato Fissato Bloccato Spostato General Discussion
javasscriptlitjswebcomponentsfrontendactivitypuboni
8 Post 2 Autori 33 Visualizzazioni
  • Da Vecchi a Nuovi
  • Da Nuovi a Vecchi
  • Più Voti
Rispondi
  • Risposta alla discussione
Effettua l'accesso per rispondere
Questa discussione è stata eliminata. Solo gli utenti con diritti di gestione possono vederla.
  • mariusor@metalhead.clubundefined Questo utente è esterno a questo forum
    mariusor@metalhead.clubundefined Questo utente è esterno a questo forum
    mariusor@metalhead.club
    scritto su ultima modifica di
    #1

    The more I work on #ONI, which is basically a web components frontend for an as basic as possible #ActivityPub client to server service, the more I realize I'm just not built for JavaScript programming.

    Despite having put in the hours every day for a number of months, the whole Promise paradigm just doesn't seem to click for me.

    Now I'm struggling to create a throbber component (easy) while fetches happen in the background (easy) and then have it replaced (not easy) by actual content (easy).

    😱 Gaaah!!!

    #frontend #web_components #litjs #JavasScript

    opinionatedgeek@mastodon.socialundefined 1 Risposta Ultima Risposta
    0
    • mariusor@metalhead.clubundefined mariusor@metalhead.club

      The more I work on #ONI, which is basically a web components frontend for an as basic as possible #ActivityPub client to server service, the more I realize I'm just not built for JavaScript programming.

      Despite having put in the hours every day for a number of months, the whole Promise paradigm just doesn't seem to click for me.

      Now I'm struggling to create a throbber component (easy) while fetches happen in the background (easy) and then have it replaced (not easy) by actual content (easy).

      😱 Gaaah!!!

      #frontend #web_components #litjs #JavasScript

      opinionatedgeek@mastodon.socialundefined Questo utente è esterno a questo forum
      opinionatedgeek@mastodon.socialundefined Questo utente è esterno a questo forum
      opinionatedgeek@mastodon.social
      scritto su ultima modifica di
      #2

      @mariusor FWIW, I'm working on a similar thing, and I've settled into a pattern like this - the component has a spinner, a viewer, and a no-data message, then have a dataBind() method like:
      ```
      dataBind(data, binder) {
      if (data) {
      this.#spinner.style.display = 'none';
      this.#viewer.style.display = null;
      this.#noData.style.display = 'none';
      } else {
      this.#spinner.style.display = 'none';
      this.#viewer.style.display = 'none';
      this.#noData.style.display = null;
      }
      }
      ```

      mariusor@metalhead.clubundefined 1 Risposta Ultima Risposta
      0
      • opinionatedgeek@mastodon.socialundefined opinionatedgeek@mastodon.social

        @mariusor FWIW, I'm working on a similar thing, and I've settled into a pattern like this - the component has a spinner, a viewer, and a no-data message, then have a dataBind() method like:
        ```
        dataBind(data, binder) {
        if (data) {
        this.#spinner.style.display = 'none';
        this.#viewer.style.display = null;
        this.#noData.style.display = 'none';
        } else {
        this.#spinner.style.display = 'none';
        this.#viewer.style.display = 'none';
        this.#noData.style.display = null;
        }
        }
        ```

        mariusor@metalhead.clubundefined Questo utente è esterno a questo forum
        mariusor@metalhead.clubundefined Questo utente è esterno a questo forum
        mariusor@metalhead.club
        scritto su ultima modifica di
        #3

        @OpinionatedGeek litjs has an idiomatic way of achieving this kind of logic.

        It has an `until(promise, fallback)` function which waits for the promise to resolve and display fallback until then.

        Even with this simple setup I still get issues. :D

        It's definitely a "me" problem. I'm holding it wrong somehow, but I haven't seen any examples in the wild of "holding it right".

        opinionatedgeek@mastodon.socialundefined 1 Risposta Ultima Risposta
        0
        • mariusor@metalhead.clubundefined mariusor@metalhead.club

          @OpinionatedGeek litjs has an idiomatic way of achieving this kind of logic.

          It has an `until(promise, fallback)` function which waits for the promise to resolve and display fallback until then.

          Even with this simple setup I still get issues. :D

          It's definitely a "me" problem. I'm holding it wrong somehow, but I haven't seen any examples in the wild of "holding it right".

          opinionatedgeek@mastodon.socialundefined Questo utente è esterno a questo forum
          opinionatedgeek@mastodon.socialundefined Questo utente è esterno a questo forum
          opinionatedgeek@mastodon.social
          scritto su ultima modifica di
          #4

          @mariusor That sounds so frustrating! (I feel your pain. I've given up in the past on libraries/add-ons that did complicated jobs but had no docs to tell me how to use them. I love examples!)

          I do like the sound of that `until()` approach. I went with an ever-more-complex databinding approach that causes me some problems with large ActivityPub objects...

          mariusor@metalhead.clubundefined 2 Risposte Ultima Risposta
          0
          • opinionatedgeek@mastodon.socialundefined opinionatedgeek@mastodon.social

            @mariusor That sounds so frustrating! (I feel your pain. I've given up in the past on libraries/add-ons that did complicated jobs but had no docs to tell me how to use them. I love examples!)

            I do like the sound of that `until()` approach. I went with an ever-more-complex databinding approach that causes me some problems with large ActivityPub objects...

            mariusor@metalhead.clubundefined Questo utente è esterno a questo forum
            mariusor@metalhead.clubundefined Questo utente è esterno a questo forum
            mariusor@metalhead.club
            scritto su ultima modifica di
            #5

            Hey @OpinionatedGeek I see you're working on ActivityPub stuff, is the code public to look at?

            1 Risposta Ultima Risposta
            0
            • opinionatedgeek@mastodon.socialundefined opinionatedgeek@mastodon.social

              @mariusor That sounds so frustrating! (I feel your pain. I've given up in the past on libraries/add-ons that did complicated jobs but had no docs to tell me how to use them. I love examples!)

              I do like the sound of that `until()` approach. I went with an ever-more-complex databinding approach that causes me some problems with large ActivityPub objects...

              mariusor@metalhead.clubundefined Questo utente è esterno a questo forum
              mariusor@metalhead.clubundefined Questo utente è esterno a questo forum
              mariusor@metalhead.club
              scritto su ultima modifica di
              #6

              @OpinionatedGeek I finally got a workable version, though I am not very satisfied with it.

              You can see it in action on my metal releases bot/ActivityPub playground: https://releases.bruta.link/outbox

              The tab at the top corresponds to the outbox collection of the actor it gets loaded in the background to show an eventual icon/name change.

              opinionatedgeek@mastodon.socialundefined 1 Risposta Ultima Risposta
              0
              • mariusor@metalhead.clubundefined mariusor@metalhead.club

                @OpinionatedGeek I finally got a workable version, though I am not very satisfied with it.

                You can see it in action on my metal releases bot/ActivityPub playground: https://releases.bruta.link/outbox

                The tab at the top corresponds to the outbox collection of the actor it gets loaded in the background to show an eventual icon/name change.

                opinionatedgeek@mastodon.socialundefined Questo utente è esterno a questo forum
                opinionatedgeek@mastodon.socialundefined Questo utente è esterno a questo forum
                opinionatedgeek@mastodon.social
                scritto su ultima modifica di
                #7

                @mariusor Nice! I like the way the data flows through the `it` attribute.

                FWIW here's how your post looks in my C2S code. Depending on circumstances, each of the main bits (the profile picture, name, each addressee, the replied-to actor, and the content) may be demand-loaded.

                mariusor@metalhead.clubundefined 1 Risposta Ultima Risposta
                0
                • opinionatedgeek@mastodon.socialundefined opinionatedgeek@mastodon.social

                  @mariusor Nice! I like the way the data flows through the `it` attribute.

                  FWIW here's how your post looks in my C2S code. Depending on circumstances, each of the main bits (the profile picture, name, each addressee, the replied-to actor, and the content) may be demand-loaded.

                  mariusor@metalhead.clubundefined Questo utente è esterno a questo forum
                  mariusor@metalhead.clubundefined Questo utente è esterno a questo forum
                  mariusor@metalhead.club
                  scritto su ultima modifica di
                  #8

                  @OpinionatedGeek nice, I like that you display explicitly the recipients.

                  So far everyone seems to want to paper over that whole mechanism with the "public" "followers" "mentions" model that Mastodon engendered.

                  1 Risposta Ultima Risposta
                  0

                  Ciao! Sembra che tu sia interessato a questa conversazione, ma non hai ancora un account.

                  Stanco di dover scorrere gli stessi post a ogni visita? Quando registri un account, tornerai sempre esattamente dove eri rimasto e potrai scegliere di essere avvisato delle nuove risposte (tramite email o notifica push). Potrai anche salvare segnalibri e votare i post per mostrare il tuo apprezzamento agli altri membri della comunità.

                  Con il tuo contributo, questo post potrebbe essere ancora migliore 💗

                  Registrati Accedi
                  Rispondi
                  • Risposta alla discussione
                  Effettua l'accesso per rispondere
                  • Da Vecchi a Nuovi
                  • Da Nuovi a Vecchi
                  • Più Voti


                  Feed RSS
                  The more I work on #ONI, which is basically a web components frontend for an as basic as possible #ActivityPub client to server service, the more I realize I'm just not built for JavaScript programming.
                  @pierobosio@soc.bosio.info
                  V4.10.1 Contributors
                  • Accedi

                  • Accedi o registrati per effettuare la ricerca.
                  • Primo post
                    Ultimo post