Skip to content

RunningConfig

Marc Espín Sanz edited this page Jun 23, 2020 · 5 revisions

RunningConfig is a reactive object holding with data needed during execution time, so its data is not saved when Graviton is closed. It also manages various events.

You can read its data, but I don't recommend you to modify its data since it could cause an error in the app. Example:

function entry(API){
  console.log(API.RunningConfig.data.focusedTab)
}

This will print active tab's element in the console.

You can also bind functions to the app events.

function entry(API){
  API.RunningConfig.on('aTabHasBeenSaved',({ tabElement }) => {
    console.log(tabElement)
  })
}

This binds a function to the event 'aTabHasBeenSaved.' Whenever a tab (file) has been saved it will execute your function, so it will print the tab's element which just got saved.

List of useful events:

  • aTabHasBeenSaved
  • aTabHasBeenFocused
  • aTabHasBeenUnfocused
  • aTabHasBeenClosed
  • aFileHasBeenCreated
  • aFolderHasBeenCreated
  • aFileHasBeenRemoved
  • aFolderHasBeenRemoved
  • gitStatusUpdated

There are some events not listed here since they are used in Graviton internally.

There are also commands, which are events you can emit to do certain things:

  • command.saveCurrentFile
  • command.newPanel
  • command.closeCurrentTab
  • command.closeCurrentPanel
  • command.openCommandPrompt

Documentation

Tutorials

Contributing

About

Clone this wiki locally