> **NOTE:** OAuth authorizations work out of the box for address http://localhost/ except for WordPress. To allow an other address, you have to add specific keys at the end of `constants.js` and eventually to set up specific proxies with the corresponding key/secret pairs ([WordPress Proxy][9], [Tumblr Proxy][10] and [Gatekeeper][11]).
> **NOTE:** The callback will not run if the user is inactive or in StackEdit Viewer. User is considered inactive after 5 minutes of inactivity (mouse or keyboard).
> **NOTE:** the offline status is also set by detecting the window `offline` event. `core.isOffline` is automatically set to `false` when the network is recovered.
The `eventMgr` module is responsible for receiving and dispatching events in **StackEdit**. The following functions of the `eventMgr` module will trigger events of the same name. Extensions can listen to these events by implementing functions with the same name. The function `addListener(eventName, callback)` of the `eventMgr` module can be used by any other module to listen to these events.
#### Core events:
- **`onReady()`**
All the modules are loaded and the DOM is ready.
> Triggered by the `core` module.
> This is preferred over [jQuery's `.ready()`][39] because it ensures that all modules are loaded by [RequireJS][40].
- **`onMessage(message)`**
A message destined to the user has been produced.
-`message`: the text string of the message.
- **`onError(error)`**
An error has been thrown.
-`error`: an error object or a string.
- **`onOfflineChanged(isOffline)`**
The off-line status has changed.
-`isOffline`: the off-line status.
> Triggered by the `core` module.
- **`onUserActive()`**
The user has just moved the mouse or pressed the keyboard.
> Triggered by the `core` module.
- **`onAsyncRunning()`**
Some asynchronous tasks have just started or stopped.
-`isRunning`: true if started, false if stopped.
> Triggered by the `AsyncTask` module.
- **`onPeriodicRun()`**
A hook that is called periodically (every 1 second if user is active).
> Triggered by the `core` module.
- **`onLoadSettings()`**
A hook that is called when the settings dialog has to be refreshed. Each extension that has configuration inputs in the settings dialog has to implement a listener for this event.
> Triggered by the `core` module. Only `Extension` objects can handle this event.
- **`onSaveSettings(newConfig, event)`**
A hook that is called when the settings dialog has to be validated. Each extension that has configuration is the settings dialog has to implement a listener for this event.
-`newConfig`: the new configuration object, deduced from the settings dialog inputs.
-`event`: the submit event object. `stopPropagation` has to be called in case of an error when parsing settings dialog inputs.
> Triggered by the `core` module. Only `Extension` objects can handle this event.
- **`onInit()`**
A hook allowing enabled extensions to initialize.
> Triggered by the `eventMgr` module. Only `Extension` objects can handle this event.
#### Module creation events:
- **`onFileMgrCreated(fileMgr)`**
The `fileMgr` module has been created.
-`fileMgr`: the `fileMgr` module.
> Triggered by the `fileMgr` module.
- **`onSynchronizerCreated(synchronizer)`**
The `synchronizer` module has been created.
-`synchronizer`: the `synchronizer` module.
> Triggered by the `synchronizer` module.
- **`onPublisherCreated(publisher)`**
The `publisher` module has been created.
-`publisher`: the `publisher` module.
> Triggered by the `publisher` module.
- **`onEventMgrCreated()`**
The `eventMgr` module has been created.
-`eventMgr`: the `eventMgr` module.
> Triggered by the `eventMgr` module.
#### Operations on files:
- **`onFileCreated(fileDesc)`**
A [`FileDescriptor`][41] object has been created.
-`fileDesc`: the [`FileDescriptor`][42] object.
> Triggered by the `fileMgr` module.
- **`onFileDeleted(fileDesc)`**
A [`FileDescriptor`][43] object has been removed from the `fileSystem` module.
-`fileDesc`: the [`FileDescriptor`][44] object.
> Triggered by the `fileMgr` module.
- **`onFileSelected(fileDesc)`**
A [`FileDescriptor`][45] object has been selected.
-`fileDesc`: the [`FileDescriptor`][46] object.
> Triggered by the `fileMgr` module. This event is triggered before `onFileClosed` (if another document is open) and `onFileOpen` events.
- **`onFileClosed(fileDesc)`**
The current [`FileDescriptor`][47] object is about to be detached from the editor.
-`fileDesc`: the [`FileDescriptor`][48] object.
> Triggered by the `fileMgr` module. This event is triggered after `onFileSelected` event and before `onFileClosed` event.
- **`onFileOpen(fileDesc)`**
The selected [`FileDescriptor`][49] object has been attached to the editor.
-`fileDesc`: the [`FileDescriptor`][50] object.
> Triggered by the `fileMgr` module. This event is triggered after `onFileSelected` and `onFileClosed` (if another document is open) events.
- **`onContentChanged(fileDesc)`**
The content of a [`FileDescriptor`][51] object has been modified.
- **`onTitleChanged()`**
The content of a [`FileDescriptor`][52] object has been modified.