Svelte makes Drag And Drop API easy!

Поділитися
Вставка
  • Опубліковано 21 лис 2024

КОМЕНТАРІ • 36

  • @JoyofCodeDev
    @JoyofCodeDev Рік тому +24

    🔥

  • @RDR-jn1sn
    @RDR-jn1sn Рік тому +3

    Finally a tutorial that doesn't use svelte-dnd-action... thanks a lot!!!

  • @Huntabyte
    @Huntabyte Рік тому +40

    What VSCode theme are you using? Joking aside, great video!

  • @SvelteSociety
    @SvelteSociety Рік тому +14

    Nice!

  • @daleyc.3008
    @daleyc.3008 8 місяців тому +1

    I tried this on Svelte 5 with runes, smooth like butter. Nice video!

    • @KeesFluitman
      @KeesFluitman Місяць тому +1

      Where would u advise do i learn svelte 5?

  • @nickstaresinic9933
    @nickstaresinic9933 Рік тому +6

    Very impressive, Antonio -- well organized and presented, and it expands my understanding of how/when to use actions. Thanks.

  • @blokche_dev
    @blokche_dev Рік тому +3

    svelte actions are so powerful. Thanks for sharing.

  • @FabianVilersBe
    @FabianVilersBe Рік тому +4

    Nice tutorial, thank you. May I add that I'd rather use the API function "dispatchEvent" on the node object to emit a "drop" custom event with the required data.
    node.dispatchEvent(new CustomEvent('custom_drop', { detail: data }));
    Then, the usage would be more idiomatic by writing
    (...)
    My two cents ;-)

  • @cv3787
    @cv3787 Рік тому +1

    Does this work with re-ordering between the items in the same column?

  • @mrsauravsahuin
    @mrsauravsahuin 3 місяці тому

    Amazing! 🔥

  • @justingolden87
    @justingolden87 Рік тому +2

    Very informative! I thought of something else for DND, not "drag and drop" lol

  • @Kikibeh
    @Kikibeh Рік тому +1

    Great video, very helpful! How would you handle the drag and drop on touch devices e.g. smartphones or tablets? May you do a video of that as well?

  • @ScriptRaccoon
    @ScriptRaccoon Рік тому +4

    Very well explained!

  • @GrzegorzPalian
    @GrzegorzPalian 9 місяців тому

    Does your "update" function actually work? Unless there is some svelte magic going on, the functions created with the initial value of `state` (like handle_dragstart) would create a closure and never get the updated value when you reassign the variable like this.
    Am I missing something here?

  • @Martin-kt8sz
    @Martin-kt8sz Рік тому +1

    Excellent video, great work !

  • @roblesrt
    @roblesrt Рік тому +1

    Amazing! Thanks for sharing!

  • @sledgex9
    @sledgex9 Рік тому +2

    Can someone explain to me 5:10? I am coming from C++ and I am a JS noob. It seems to me that changing the "state" variable after the draggable() function has returned (via update()) it will also affect the data seen inside handle_dragstart() after it is called as an event listener at a later time. Is that correct? So the "state" variable not only outlives the draggable() function but it also has effects on the nested functions?
    Does this behavior/pattern have a name in JS so I can read up on it?

    • @trzcin5724
      @trzcin5724 Рік тому +3

      I think this is called a closure.

    • @sledgex9
      @sledgex9 Рік тому +1

      @@trzcin5724 Thank you. I had just read up on Closures on MDN. I'll give a more detailed comment below this one.

    • @sledgex9
      @sledgex9 Рік тому +3

      For any other noob wondering: You must read on what "closures" are in Javascript and how they behave in that context. MDN has a very good article on them. In short and very simple words(mostly in C++ speak): Closures( lambdas in C++) capture the variables in their surroundings by reference AND extend their lifetime. Hence, a variable captured in one closure can be updated in another closure that has captured the same variable even if that variable was local to the surrounding scope.

  • @NabekenProG87
    @NabekenProG87 4 місяці тому +1

    Very cool, unfortunaltely the DnD API does not work on mobile :c. I don't want to use another library, I just want to be happy

  • @FrostFlag
    @FrostFlag 9 місяців тому

    lifesaver, this is so useful!

  • @Hurby24
    @Hurby24 Рік тому +3

    great video

  • @hallowatcher
    @hallowatcher Рік тому +1

    Cool, thanks!

  • @Arcade_Archie
    @Arcade_Archie 2 місяці тому

    Was bewirkt das '@const' im svelte/html code?

  • @naranyala_dev
    @naranyala_dev Рік тому +3

    more about svelte 😍

  • @alpaslaneldemir6904
    @alpaslaneldemir6904 Рік тому +3

    Just incase someone implementing this on Tauri + Svelte set the "fileDropEnabled":false .

  • @zipcod7726
    @zipcod7726 Рік тому +2

    Cool!
    I subscribe

  • @IStMl
    @IStMl Рік тому +1

    Wow

  • @charlesokorobo508
    @charlesokorobo508 4 місяці тому

    You've said that you want to create simple things, on the Web platform.
    Unfortunately, these simple things will not take us anywhere.
    Please do a useful series, that can teach us to build massive Projects with Svelte and SvelteKit-- when you do find the time for it.
    WHAT WOULD I WANT?
    Here ( ua-cam.com/video/z1UMKqMN3VQ/v-deo.html ) is a series on building a Facebook clone with the MERN Stack (MongoDB, Express, React and Node)
    I will need you to do the same thing that this person did, and show us how to build the same thing (Facebook clone) with Svelte, SvelteKit and Postgres database.
    Regards.

  • @figloalds
    @figloalds 3 місяці тому

    This should work
    ... And it didn't
    This is the most "Programmer thing" I can think of