• Packages
  • Themes
  • Documentation
  • Blog
  • Discuss
Sign in
Whoops, there was an error
v1.34.0
v1.33.1
v1.33.0
v1.32.2
v1.32.1
v1.32.0
v1.31.2
v1.31.1
v1.31.0
v1.30.0
v1.29.0
v1.28.2
v1.28.1
v1.28.0
untagged-688de6479cca05b51c00
untagged-2abd5a23b4430027c837
v1.27.2
v1.27.1
v1.27.0
v1.26.1
v1.26.0
v1.25.1
v1.25.0
v1.24.1
v1.24.0
v1.23.3
v1.23.2
v1.23.1
v1.23.0
v1.22.1
v1.22.0
v1.21.2
v1.21.1
v1.21.0
v1.20.1
v1.20.0
v1.19.7
v1.19.6
v1.19.5
v1.19.4
v1.19.3
v1.19.2
v1.19.1
v1.19.0
v1.18.0
v1.17.2
v1.17.1
v1.17.0
v1.16.0
v1.15.0
v1.14.4
v1.14.3
v1.14.2
v1.14.1
v1.14.0
v1.13.1
v1.13.0
v1.12.9
v1.12.8
v1.12.7
v1.12.6
v1.12.5
v1.12.4
v1.12.3
v1.12.2
v1.12.1
v1.12.0
v1.11.2
v1.11.1
v1.11.0
v1.10.2
v1.10.1
v1.10.0
v1.9.9
v1.9.8
v1.9.7
v1.9.6
v1.9.5
v1.9.4
v1.9.3
v1.9.2
v1.9.1
v1.9.0
v1.8.0
v1.7.4
v1.7.3
v1.7.2
v1.7.1
v1.7.0
v1.6.2
v1.6.1
v1.6.0
v1.5.4
v1.5.3
v1.5.2
v1.5.1
v1.5.0
v1.4.3
v1.4.2
v1.4.1
v1.4.0
v1.3.3
v1.3.2
v1.3.1
v1.3.0
v1.2.4
v1.2.3
v1.2.2
v1.2.1
v1.2.0
v1.1.0
v1.0.19
v1.0.18
v1.0.17
v1.0.16
v1.0.15
v1.0.14
v1.0.13
v1.0.12
v1.0.11
v1.0.10
v1.0.9
v1.0.8
v1.0.7
v1.0.6
v1.0.5
v1.0.4
v1.0.3
v1.0.2
v1.0.1
v1.0.0
v0.211.0
v0.210.0
v0.209.0
v0.208.0
v0.207.0
v0.206.0
v0.205.0
v0.204.0
v0.203.0
v0.202.0
v0.201.0
v0.200.0
v0.199.0
v0.198.0
v0.197.0
v0.196.0
v0.195.0
v0.194.0
v0.193.0
v0.192.0
v0.191.0
v0.190.0
v0.189.0
v0.188.0
v0.187.0
Loading…

Essential Classes

  • AtomEnvironment
  • Color
  • CommandRegistry
  • CompositeDisposable
  • Config
  • Decoration
  • DisplayMarker
  • DisplayMarkerLayer
  • Disposable
  • Emitter
  • LayerDecoration
  • MarkerLayer
  • Notification
  • NotificationManager
  • Point
  • Range
  • TextEditor
  • TooltipManager
  • ViewRegistry
  • Workspace
  • WorkspaceCenter

Extended Classes

  • BufferedNodeProcess
  • BufferedProcess
  • Clipboard
  • ContextMenuManager
  • Cursor
  • DeserializerManager
  • Directory
  • Dock
  • File
  • GitRepository
  • Grammar
  • GrammarRegistry
  • Gutter
  • HistoryManager
  • KeymapManager
  • MenuManager
  • Package
  • PackageManager
  • Pane
  • Panel
  • PathWatcher
  • Project
  • ScopeDescriptor
  • Selection
  • StyleManager
  • Task
  • TextBuffer
  • ThemeManager

AtomEnvironment essential

Atom global for dealing with packages, themes, menus, and the window.

An instance of this class is always available as the atom global.

Properties

::clipboard

A Clipboard instance

::deserializers

A DeserializerManager instance

::views

A ViewRegistry instance

::notifications

A NotificationManager instance

::config

A Config instance

::keymaps

A KeymapManager instance

::tooltips

A TooltipManager instance

::commands

A CommandRegistry instance

::grammars

A GrammarRegistry instance

::styles

A StyleManager instance

::packages

A PackageManager instance

::themes

A ThemeManager instance

::menu

A MenuManager instance

::contextMenu

A ContextMenuManager instance

::project

A Project instance

::textEditors

A TextEditorRegistry instance

::workspace

A Workspace instance

::history

A HistoryManager instance

Event Subscription

This section only has Extended methods.

Extended Methods

::onDidBeep(callback)

Invoke the given callback whenever ::beep is called.

Argument Description
callback()

Function to be called whenever ::beep is called.

Return values

Returns a Disposable on which .dispose() can be called to unsubscribe.

::onWillThrowError(callback)

Invoke the given callback when there is an unhandled error, but before the devtools pop open

Argument Description
callback(event)

Function to be called whenever there is an unhandled error

event

Object

.originalError

Object the original error object

.message

String the original error object

.url

String Url to the file where the error originated.

.line

Number

.column

Number

.preventDefault()

Function call this to avoid popping up the dev tools.

Return values

Returns a Disposable on which .dispose() can be called to unsubscribe.

::onDidThrowError(callback)

Invoke the given callback whenever there is an unhandled error.

Argument Description
callback(event)

Function to be called whenever there is an unhandled error

event

Object

.originalError

Object the original error object

.message

String the original error object

.url

String Url to the file where the error originated.

.line

Number

.column

Number

Return values

Returns a Disposable on which .dispose() can be called to unsubscribe.

::whenShellEnvironmentLoaded(callback)

Invoke the given callback as soon as the shell environment is loaded (or immediately if it was already loaded).

Argument Description
callback()

Function to be called whenever there is an unhandled error

Atom Details

::inDevMode()

Return values

Returns a Boolean that is true if the current window is in development mode.

::inSafeMode()

Return values

Returns a Boolean that is true if the current window is in safe mode.

::inSpecMode()

Return values

Returns a Boolean that is true if the current window is running specs.

::getVersion()

Get the version of the Atom application.

Return values

Returns the version text String.

::getReleaseChannel()

Gets the release channel of the Atom application.

Return values

Returns the release channel as a String. Will return a specific release channel name like 'beta' or 'nightly' if one is found in the Atom version or 'stable' otherwise.

::isReleasedVersion()

Return values

Returns a Boolean that is true if the current version is an official release.

::getWindowLoadTime()

Get the time taken to completely load the current window.

This time include things like loading and activating packages, creating DOM elements for the editor, and reading the config.

Return values

Returns the Number of milliseconds taken to load the window or null if the window hasn't finished loading yet.

::getLoadSettings()

Get the load settings for the current window.

Return values

Returns an Object containing all the load setting key/value pairs.

Managing The Atom Window

::open(params)

Open a new Atom window using the given options.

Calling this method without an options parameter will open a prompt to pick a file/folder to open in the new window.

Argument Description
params

An Object with the following keys:

.pathsToOpen

An Array of String paths to open.

.newWindow

A Boolean, true to always open a new window instead of reusing existing windows depending on the paths to open.

.devMode

A Boolean, true to open the window in development mode. Development mode loads the Atom source from the locally cloned repository and also loads all the packages in ~/.atom/dev/packages

.safeMode

A Boolean, true to open the window in safe mode. Safe mode prevents all packages installed to ~/.atom/packages from loading.

::close()

Close the current window.

::getSize()

Get the size of current window.

Return values

Returns an Object in the format {width: 1000, height: 700}

::setSize(width, height)

Set the size of current window.

Argument Description
width

The Number of pixels.

height

The Number of pixels.

::getPosition()

Get the position of current window.

Return values

Returns an Object in the format {x: 10, y: 20}

::setPosition(x, y)

Set the position of current window.

Argument Description
x

The Number of pixels.

y

The Number of pixels.

Extended Methods

::pickFolder(callback)

Prompt the user to select one or more folders.

Argument Description
callback(paths)

A Function to call once the user has confirmed the selection.

paths

An Array of String paths that the user selected, or null if the user dismissed the dialog.

::getCurrentWindow()

Get the current window

::center()

Move current window to the center of the screen.

::focus()

Focus the current window.

::show()

Show the current window.

::hide()

Hide the current window.

::reload()

Reload the current window.

::restartApplication()

Relaunch the entire application.

::isMaximized()

Return values

Returns a Boolean that is true if the current window is maximized.

::isFullScreen()

Return values

Returns a Boolean that is true if the current window is in full screen mode.

::setFullScreen()

Set the full screen state of the current window.

::toggleFullScreen()

Toggle the full screen state of the current window.

Messaging the User

::beep()

Visually and audibly trigger a beep.

::confirm(options, [callback])

A flexible way to open a dialog akin to an alert dialog.

While both async and sync versions are provided, it is recommended to use the async version such that the renderer process is not blocked while the dialog box is open.

The async version accepts the same options as Electron's dialog.showMessageBox. For convenience, it sets type to 'info' and normalizeAccessKeys to true by default.

If the dialog is closed (via Esc key or X in the top corner) without selecting a button the first button will be clicked unless a "Cancel" or "No" button is provided.

// Async version (recommended) 
atom.confirm({
  message: 'How you feeling?',
  detail: 'Be honest.',
  buttons: ['Good', 'Bad']
}, response => {
  if (response === 0) {
    window.alert('good to hear')
  } else {
    window.alert('bummer')
  }
})
 
```js
// Legacy sync version 
const chosen = atom.confirm({
  message: 'How you feeling?',
  detailedMessage: 'Be honest.',
  buttons: {
    Good: () => window.alert('good to hear'),
    Bad: () => window.alert('bummer')
  }
})
Argument Description
options

An options Object. If the callback argument is also supplied, see the documentation at https://electronjs.org/docs/api/dialog#dialogshowmessageboxbrowserwindow-options-callback for the list of available options. Otherwise, only the following keys are accepted:

.message

The String message to display.

.detailedMessage optional

The String detailed message to display.

.buttons optional

Either an Array of Strings or an Object where keys are button names and the values are callback Functions to invoke when clicked.

callback() optional

A Function that will be called with the index of the chosen option. If a callback is supplied, the dialog will be non-blocking. This argument is recommended.

Return values

Returns the chosen button index Number if the buttons option is an array or the return value of the callback if the buttons option is an object. If a callback function is supplied, returns undefined.

Managing the Dev Tools

This section only has Extended methods.

Extended Methods

::openDevTools()

Open the dev tools for the current window.

Return values

Returns a Promise that resolves when the DevTools have been opened.

::toggleDevTools()

Toggle the visibility of the dev tools for the current window.

Return values

Returns a Promise that resolves when the DevTools have been opened or closed.

::executeJavaScriptInDevTools()

Execute code in dev tools.

  • Terms of Use
  • Privacy
  • Code of Conduct
  • Releases
  • FAQ
  • Contact
with by