Skip to content

Commit

Permalink
Merge pull request #549 from jpmorganchase/viewer-table-ownership
Browse files Browse the repository at this point in the history
Added table ownership flag to `<perspective-viewer>` `delete()` method
  • Loading branch information
texodus committed Apr 22, 2019
2 parents 52d134e + 6b5e79b commit 17a39de
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
6 changes: 4 additions & 2 deletions packages/perspective-viewer/src/js/viewer.js
Original file line number Diff line number Diff line change
Expand Up @@ -457,11 +457,13 @@ class PerspectiveViewer extends ActionElement {
* user state). This (or the underlying `perspective.table`'s equivalent
* method) must be called in order for its memory to be reclaimed.
*
* @param {boolean} delete_table Should a delete call also be made to the
* underlying `table()`.
* @returns {Promise<boolean>} Whether or not this call resulted in the
* underlying `perspective.table` actually being deleted.
*/
delete() {
let x = this._clear_state();
delete(delete_table = true) {
let x = this._clear_state(delete_table);
if (this._plugin.delete) {
this._plugin.delete.call(this);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,7 @@ export class PerspectiveElement extends StateElement {
return () => this.setAttribute("render_time", performance.now() - t);
}

_clear_state() {
_clear_state(clear_table = true) {
if (this._task) {
this._task.cancel();
}
Expand All @@ -324,7 +324,7 @@ export class PerspectiveElement extends StateElement {
view.remove_update(this._view_updater);
view.remove_delete();
}
if (this._table) {
if (this._table && clear_table) {
const table = this._table;
this._table = undefined;
if (table._owner_viewer && table._owner_viewer === this) {
Expand Down

0 comments on commit 17a39de

Please sign in to comment.