import { mix } from '../helpers/mixin.js';
import { CallbackManager } from 'chialab-callback-manager/src/callback-manager.js';

export const CallbackMixin =
    (superClass) => class extends mix(superClass).with(CallbackManager.mixin) {
        destroy() {
            super.destroy();
            this.off();
        }
    };

@@ -36,16 +36,67 @@
 in.js';%0A
+import %7B internal %7D from '../helpers/internal.js';%0A
 import %7B
@@ -277,24 +277,428 @@
 er.mixin) %7B%0A
+        constructor(...args) %7B%0A            super(...args);%0A            internal(this).listeners = %5B%5D;%0A        %7D%0A%0A        listen(scope, ev, callback) %7B%0A            internal(this).listeners.push(%0A                scope.on(ev, callback)%0A            );%0A        %7D%0A%0A        unlisten() %7B%0A            internal(this).listeners.forEach((destroy) =%3E destroy());%0A            internal(this).listeners = %5B%5D;%0A        %7D%0A%0A
         dest
@@ -730,24 +730,53 @@
 .destroy();%0A
+            this.unlisten();%0A
             

add listen and unlisten methods to callback mixin