Skip to content

Commit

Permalink
less change in the SaveableWidget interface
Browse files Browse the repository at this point in the history
  • Loading branch information
colin-grant-work committed Jan 19, 2022
1 parent c4d1b5a commit cc661f5
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions packages/core/src/browser/saveable.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ export namespace Saveable {
}
}

async function closeWithoutSaving(this: SaveableWidget, doRevert: boolean = true): Promise<void> {
async function closeWithoutSaving(this: PostCreationSaveableWidget, doRevert: boolean = true): Promise<void> {
const saveable = get(this);
if (saveable && doRevert && saveable.dirty && saveable.revert) {
await saveable.revert();
Expand Down Expand Up @@ -195,15 +195,22 @@ export namespace Saveable {
}
}

export const close = Symbol('close');
export interface SaveableWidget extends Widget {
/**
* @param doRevert whether the saveable should be reverted before being saved. Defaults to `true`.
*/
closeWithoutSaving(doRevert?: boolean): Promise<void>;
closeWithSaving(options?: SaveableWidget.CloseOptions): Promise<void>;
}

export const close = Symbol('close');
/**
* An interface describing saveable widgets that are created by the `Saveable.apply` function.
* The original `close` function is reassigned to a locally-defined `Symbol`
*/
export interface PostCreationSaveableWidget extends SaveableWidget {
/**
* The original close function of the widget
* The original `close` function of the widget
*/
[close](): void;
}
Expand Down

0 comments on commit cc661f5

Please sign in to comment.