Caret/js
2014-07-13 18:41:16 -07:00
..
ace Update Ace to 1.1.5 2014-07-13 18:41:16 -07:00
lib Add es6-promise shim, so we can convert over to browser promises as soon as they're available. 2013-12-22 10:56:13 -08:00
sessions Move word count and other toasts to i18n 2014-07-07 11:49:13 -07:00
storage File.retain() specifies type instead of returning raw ID 2014-06-29 16:56:22 -07:00
ui Localize the edit project error. 2014-07-11 20:41:47 -07:00
util Move dialog text into i18n 2014-07-07 11:32:05 -07:00
aceBindings.js Added "wrap" function: 2014-05-24 19:34:00 -04:00
api.js Added editor context to API execution. Fixes #220 2014-06-22 00:13:11 -07:00
command.js Code cleanup and commenting. 2014-02-26 22:34:02 -08:00
editor.js Move word count and other toasts to i18n 2014-07-07 11:49:13 -07:00
fileManager.js Localization for menus and palette mostly done. 2014-07-07 09:10:37 -07:00
main.js Move dialog text into i18n 2014-07-07 11:32:05 -07:00
readme.md Update the module readme files. 2014-05-14 21:31:20 -07:00
sessions.js Move tab retention to an ongoing process, instead of doing it after render. 2014-07-06 19:30:39 -07:00
settings.js Code cleanup and commenting. 2014-02-26 22:34:02 -08:00
tab.js Fixes #230 2014-05-23 17:49:54 -07:00

Module descriptions - core

This document serves as basic documentation for Caret's AMD modules. It's not exhaustive, but it will serve as a starting place for anyone wanting to dive in a little deeper.

Caret's execution starts in main.js, which mostly serves as bootstrap for the other modules. It also registers command listeners for the UI themes, various window events, and app-level commands like app:check-for-updates. After that, we really get down to business.

In addition to the module folders, which contain their own readme files, there are also folders for the current Ace build (ace) and any external libraries used by Caret, such as the ES6 Promises shim (lib).

aceBindings.js

Takes care of any messiness between Caret and Ace APIs. Registers the ace:command listener, as well as a bunch of Sublime emulation commands. Exposes no external methods or data.

api.js

Registers for chrome.runtime.onMessageExternal events, patching them into the command module, and dispatches messages from api:execute commands. Exposes no external methods or data.

command.js

Serves as a messaging buffer between modules, and from declarative DOM attributes to modules. Exposes three properties: fire() for sending commands, on() for subscribing to them, and an array called list that can be used to add palette-only items at runtime.

editor.js

Sets up the Ace editor and registers for events in the editor:* namespace. Returns the Ace object.

fileManager.js

Handles opening files from launch data, retained handles, and user commands. Exposes no external methods or data.

sessions.js

Manages Caret's tabs, including all UI interaction with the tab bar and the process of adding or removing tabs. Exposes a number of methods and manipulating the tab structure. Most of the actual session code is loaded from the /sessions folder, to make the file more manageable.

settings.js

Runs as a RequireJS plugin, so that dependent modules can rely on having settings available on startup, but actually just returns the same singleton as storage/settingsProvider.

tab.js

Exposes a Tab constructor to dependents, which is an augmented Ace EditorSession. Tabs do additional setup work to support Caret, as well as adding methods for saving files and dropping retained file handles.