mirror of
https://github.com/mathuo/dockview
synced 2025-01-23 18:05:58 +00:00
chore: cleanup code
This commit is contained in:
parent
9ee2b821ff
commit
d29052e606
@ -28,8 +28,7 @@ export interface DockviewGroupPanelFloatingChangeEvent {
|
|||||||
readonly location: DockviewGroupLocation;
|
readonly location: DockviewGroupLocation;
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO find a better way to initialize and avoid needing null checks
|
const NOT_INITIALIZED_MESSAGE = 'dockview: DockviewGroupPanelApiImpl not initialized';
|
||||||
const NOT_INITIALIZED_MESSAGE = 'DockviewGroupPanelApiImpl not initialized';
|
|
||||||
|
|
||||||
export class DockviewGroupPanelApiImpl extends GridviewPanelApiImpl {
|
export class DockviewGroupPanelApiImpl extends GridviewPanelApiImpl {
|
||||||
private readonly _mutableDisposable = new MutableDisposable();
|
private readonly _mutableDisposable = new MutableDisposable();
|
||||||
@ -130,15 +129,16 @@ export class DockviewGroupPanelApiImpl extends GridviewPanelApiImpl {
|
|||||||
}
|
}
|
||||||
|
|
||||||
initialize(group: DockviewGroupPanel): void {
|
initialize(group: DockviewGroupPanel): void {
|
||||||
this._group = group;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* TODO: Annoying initialization order caveat
|
* TODO: Annoying initialization order caveat, find a better way to initialize and avoid needing null checks
|
||||||
*
|
*
|
||||||
* Due to the order on initialization we know that the model isn't defined until later in the same stack-frame of setup.
|
* Due to the order on initialization we know that the model isn't defined until later in the same stack-frame of setup.
|
||||||
* By queuing a microtask we can ensure the setup is completed within the same stack-frame, but after everything else has
|
* By queuing a microtask we can ensure the setup is completed within the same stack-frame, but after everything else has
|
||||||
* finished ensuring the `model` is defined.
|
* finished ensuring the `model` is defined.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
this._group = group;
|
||||||
|
|
||||||
queueMicrotask(() => {
|
queueMicrotask(() => {
|
||||||
this._mutableDisposable.value =
|
this._mutableDisposable.value =
|
||||||
this._group!.model.onDidActivePanelChange((event) => {
|
this._group!.model.onDidActivePanelChange((event) => {
|
||||||
|
@ -1,7 +1,5 @@
|
|||||||
class TransferObject {
|
class TransferObject {
|
||||||
constructor() {
|
|
||||||
// intentionally empty class
|
// intentionally empty class
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export class PanelTransfer extends TransferObject {
|
export class PanelTransfer extends TransferObject {
|
||||||
|
@ -828,7 +828,7 @@ export class DockviewComponent
|
|||||||
this.updateWatermark();
|
this.updateWatermark();
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
console.error(err);
|
console.error('dockview: failed to create popout window', err);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2104,7 +2104,7 @@ export class DockviewComponent
|
|||||||
|
|
||||||
if (id && this._groups.has(options.id!)) {
|
if (id && this._groups.has(options.id!)) {
|
||||||
console.warn(
|
console.warn(
|
||||||
`Duplicate group id ${options?.id}. reassigning group id to avoid errors`
|
`dockview: Duplicate group id ${options?.id}. reassigning group id to avoid errors`
|
||||||
);
|
);
|
||||||
id = undefined;
|
id = undefined;
|
||||||
}
|
}
|
||||||
|
@ -69,7 +69,7 @@ class Stacktrace {
|
|||||||
private constructor(readonly value: string) {}
|
private constructor(readonly value: string) {}
|
||||||
|
|
||||||
print(): void {
|
print(): void {
|
||||||
console.warn(this.value);
|
console.warn('dockview: stacktrace', this.value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -124,7 +124,7 @@ export class Emitter<T> implements IDisposable {
|
|||||||
this._listeners.splice(index, 1);
|
this._listeners.splice(index, 1);
|
||||||
} else if (Emitter.ENABLE_TRACKING) {
|
} else if (Emitter.ENABLE_TRACKING) {
|
||||||
// console.warn(
|
// console.warn(
|
||||||
// `Listener already disposed`,
|
// `dockview: listener already disposed`,
|
||||||
// Stacktrace.create().print()
|
// Stacktrace.create().print()
|
||||||
// );
|
// );
|
||||||
}
|
}
|
||||||
@ -158,7 +158,10 @@ export class Emitter<T> implements IDisposable {
|
|||||||
queueMicrotask(() => {
|
queueMicrotask(() => {
|
||||||
// don't check until stack of execution is completed to allow for out-of-order disposals within the same execution block
|
// don't check until stack of execution is completed to allow for out-of-order disposals within the same execution block
|
||||||
for (const listener of this._listeners) {
|
for (const listener of this._listeners) {
|
||||||
console.warn(listener.stacktrace?.print());
|
console.warn(
|
||||||
|
'dockview: stacktrace',
|
||||||
|
listener.stacktrace?.print()
|
||||||
|
);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user