Skip to content

Commit

Permalink
Try out different approach for multi inheritance (#2)
Browse files Browse the repository at this point in the history
  • Loading branch information
cdauth committed Dec 12, 2022
1 parent 31a428b commit c58d8bf
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
13 changes: 8 additions & 5 deletions src/handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,14 @@ export interface DraggableLinesHandlerOptions {
removeOnClick?: boolean;
}

export default class DraggableLinesHandler extends Handler {

export default class DraggableLinesHandler extends (() => {
function HandlerAndEvented(this: Handler & Evented, map: Map) {
Handler.call(this, map);
}
Object.setPrototypeOf(HandlerAndEvented.prototype, Handler.prototype);
Object.assign(HandlerAndEvented.prototype, Evented.prototype);
return HandlerAndEvented as any as new (map: Map) => Handler & Evented;
})() {
options: DraggableLinesHandlerOptions;

_tempMarker?: DraggableLinesTempMarker;
Expand Down Expand Up @@ -242,6 +248,3 @@ export default class DraggableLinesHandler extends Handler {
}

}

export default interface DraggableLinesHandler extends Evented {}
Object.assign(DraggableLinesHandler.prototype, Evented.prototype);
4 changes: 1 addition & 3 deletions src/index-umd.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,7 @@ import DraggableLinesTempMarker from './markers/tempMarker';
import DraggableLinesPlusMarker, { DraggableLinesPlusTempMarker } from './markers/plusMarker';
import './type-fixup';

export default DraggableLinesHandler;

Object.assign(DraggableLinesHandler, {
export default Object.assign(DraggableLinesHandler, {
...utils,
icons,
Marker: DraggableLinesMarker,
Expand Down

0 comments on commit c58d8bf

Please sign in to comment.