Skip to content
This repository was archived by the owner on Mar 3, 2023. It is now read-only.
This repository was archived by the owner on Mar 3, 2023. It is now read-only.

Add prevent option to ::onWillDestroyPaneItem() #12376

@ericcornelissen

Description

@ericcornelissen

Might be useful as a reference: ::onWillDestroyPaneItem() documentation

Steps which explain the enhancement

atom.workspace.onWillDestroyPaneItem (event) =>
    event.prevent()
  1. Call .prevent() on the event given as argument to the callback function in ::onWillDestroyPaneItem.
  2. .prevent() can toggle a boolean variable on the .item, letting the system know it should not be closed.
  3. Instead of closing the pane item, the boolean variable will be toggled back.

Current and suggested behavior

Currently there is no way to prevent closing a tab via the JavaScript of a package. But a user of my package pinned-tabs suggested a feature that requires this functionality. All this suggestion should really add is a way to prevent closing a tab when Atom reached the 'WillDestroy' state.

Why would the enhancement be useful to most users

It will mostly be useful for people that want to create a package that in one way or another have 'priority' tabs that they don't want to be closed when for example the close-all-tabs command is fired.

Atom Version: 1.9.7
OS and Version: Windows 10

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions