Svelte makes Drag And Drop API easy!

แชร์
ฝัง
  • เผยแพร่เมื่อ 8 ก.ย. 2024

ความคิดเห็น • 35

  • @JoyofCodeDev
    @JoyofCodeDev ปีที่แล้ว +23

    🔥

  • @Huntabyte
    @Huntabyte ปีที่แล้ว +38

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

  • @RDR-jn1sn
    @RDR-jn1sn ปีที่แล้ว +3

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

  • @SvelteSociety
    @SvelteSociety ปีที่แล้ว +14

    Nice!

  • @nickstaresinic9933
    @nickstaresinic9933 ปีที่แล้ว +6

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

  • @FabianVilersBe
    @FabianVilersBe 11 หลายเดือนก่อน +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 ;-)

  • @daleyc.3008
    @daleyc.3008 5 หลายเดือนก่อน

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

  • @blokche_dev
    @blokche_dev ปีที่แล้ว +2

    svelte actions are so powerful. Thanks for sharing.

  • @justingolden87
    @justingolden87 ปีที่แล้ว +2

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

  • @ScriptRaccoon
    @ScriptRaccoon ปีที่แล้ว +4

    Very well explained!

  • @Martin-kt8sz
    @Martin-kt8sz ปีที่แล้ว +1

    Excellent video, great work !

  • @mrsauravsahuin
    @mrsauravsahuin 15 วันที่ผ่านมา

    Amazing! 🔥

  • @roblesrt
    @roblesrt ปีที่แล้ว +1

    Amazing! Thanks for sharing!

  • @FrostFlag
    @FrostFlag 6 หลายเดือนก่อน

    lifesaver, this is so useful!

  • @Hurby24
    @Hurby24 ปีที่แล้ว +3

    great video

  • @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?

  • @naranyala_dev
    @naranyala_dev ปีที่แล้ว +3

    more about svelte 😍

  • @alpaslaneldemir6904
    @alpaslaneldemir6904 ปีที่แล้ว +2

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

  • @hallowatcher
    @hallowatcher ปีที่แล้ว +1

    Cool, thanks!

  • @cv3787
    @cv3787 11 หลายเดือนก่อน +1

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

  • @Arcade_Archie
    @Arcade_Archie 14 ชั่วโมงที่ผ่านมา

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

  • @zipcod7726
    @zipcod7726 ปีที่แล้ว +2

    Cool!
    I subscribe

  • @GrzegorzPalian
    @GrzegorzPalian 6 หลายเดือนก่อน

    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?

  • @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.

  • @IStMl
    @IStMl ปีที่แล้ว +1

    Wow

  • @NabekenProG87
    @NabekenProG87 2 หลายเดือนก่อน

    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

  • @figloalds
    @figloalds หลายเดือนก่อน

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

  • @charlesokorobo508
    @charlesokorobo508 หลายเดือนก่อน

    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 ( th-cam.com/video/z1UMKqMN3VQ/w-d-xo.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.