File tree Expand file tree Collapse file tree 1 file changed +5
-5
lines changed
src/directives/drag-and-drop/droppable-mailbox Expand file tree Collapse file tree 1 file changed +5
-5
lines changed Original file line number Diff line number Diff line change 44 */
55import { DroppableMailbox } from './droppable-mailbox.js'
66
7- let instances = [ ]
7+ const instances = new WeakMap ( )
88
99function onBind ( el , binding ) {
1010 const instance = new DroppableMailbox ( el , binding . value )
11- instances . push ( instance )
11+ instances . set ( el , instance )
1212}
1313
1414function onUpdate ( el , binding ) {
15- const instance = instances . find ( ( instance ) => instance . el === el )
15+ const instance = instances . get ( el )
1616 if ( instance ) {
1717 instance . options = binding . value
1818 }
1919}
2020
2121function onUnbind ( el ) {
22- const instance = instances . find ( ( instance ) => instance . el === el )
22+ const instance = instances . get ( el )
2323 if ( instance ) {
2424 instance . removeListeners ( el )
2525 }
26- instances = instances . filter ( ( instance ) => instance . el !== el )
26+ instances . delete ( el )
2727}
2828
2929export const DroppableMailboxDirective = {
You can’t perform that action at this time.
0 commit comments