Atom extends Model

Summary

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

The singleton of this class is always available as the atom global.

Instance Methods

onDidBeep(callback)

Invoke the given callback whenever beep is called.

Parameters
Argument Description
callback

Function to be called whenever beep is called.

Returns
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

Parameters
Argument Description
callback

Function to be called whenever there is an unhandled error

Returns
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.

Parameters
Argument Description
callback

Function to be called whenever there is an unhandled error

Returns
Return Values

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

trace()

Run the Chromium content-tracing module for five seconds, and save the output to a file which is printed to the command-line output of the app. You can take the file exported by this function and load it into Chrome's content trace visualizer (chrome://tracing). It's like Chromium Developer Tools Profiler, but for all processes and threads.

inDevMode()

Is the current window in development mode?

inSafeMode()

Is the current window in safe mode?

inSpecMode()

Is the current window running specs?

getVersion()

Get the version of the Atom application.

Returns
Return Values

Returns the version text String.

isReleasedVersion()

Determine whether 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.

Returns
Return Values

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

close()

Close the current window.

getSize()

Get the size of current window.

Returns
Return Values

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

setSize(widthheight)

Set the size of current window.

Parameters
Argument Description
width

The Number of pixels.

height

The Number of pixels.

getPosition()

Get the position of current window.

Returns
Return Values

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

setPosition(xy)

Set the position of current window.

Parameters
Argument Description
x

The Number of pixels.

y

The Number of pixels.

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.

getWindowProps()

The windowProps passed when creating the window via newWindow.

onWindowPropsReceived()

If your package declares hot-loaded window types, onWindowPropsReceived fires when your hot-loaded window is about to be shown so you can update components to reflect the new window props.

  • callback: A function to call when window props are received, just before the hot window is shown. The first parameter is the new windowProps.

isMaximixed()

Is the current window maximized?

isFullScreen()

Is the current window in full screen mode?

setFullScreen()

Set the full screen state of the current window.

toggleFullScreen()

Toggle the full screen state of the current window.

beep()

Visually and audibly trigger a beep.

confirm(options)

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

Parameters
Argument Description
options

An Object with the following keys:

Returns
Return Values

Returns the chosen button index Number if the buttons option was an array.

openDevTools()

Open the dev tools for the current window.

toggleDevTools()

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

executeJavaScriptInDevTools()

Execute code in dev tools.