import Mixin from '@ember/object/mixin';
import { cancel, later } from '@ember/runloop';

export default Mixin.create({
  actions: {
    prevent() {
      return false;
    },

    open(dropdown) {
      if (this.closeTimer) {
        cancel(this.closeTimer);
        this.closeTimer = null;
      } else {
        dropdown.actions.open();
      }
    },

    closeLater(dropdown) {
      this.closeTimer = later(() => {
        this.closeTimer = null;
        dropdown.actions.close();
      }, 200);
    }
  },

});

@@ -42,16 +42,22 @@
 import %7B
+ next,
  cancel,
@@ -87,16 +87,58 @@
 unloop';
+%0Aimport %7B get, set %7D from '@ember/object';
 %0A%0Aexport
@@ -161,16 +161,37 @@
 reate(%7B%0A
+  clostTimer: null,%0A%0A
   action
@@ -270,72 +270,126 @@
     
-if 
+const ct = get
 (this
-.
+, '
 clos
-e
+t
 Timer
-) %7B%0A        cancel(this.closeTimer
+');%0A%0A      if (ct) %7B%0A%0A        next(() =%3E %7B%0A          cancel(ct);%0A        %7D
 );%0A
+%0A
         
 this
@@ -384,39 +384,47 @@
         
+set(
 this
-.
+, '
 clos
-e
+t
 Timer
- =
+',
  null
-;
+);%0A
 %0A      %7D
@@ -431,16 +431,40 @@
  else %7B%0A
+%0A        next(() =%3E %7B%0A  
         
@@ -484,24 +484,37 @@
 ons.open();%0A
+        %7D);%0A%0A
       %7D%0A    
@@ -540,24 +540,25 @@
 dropdown) %7B%0A
+%0A
       this.c
@@ -575,32 +575,33 @@
 = later(() =%3E %7B%0A
+%0A
         this.clo
@@ -616,16 +616,17 @@
 = null;%0A
+%0A
         
@@ -647,24 +647,25 @@
 ns.close();%0A
+%0A
       %7D, 200
@@ -667,16 +667,17 @@
 , 200);%0A
+%0A
     %7D%0A  

fix random open hover dropdown remaining open