Caret/js
2014-02-21 21:13:20 -08:00
..
ace Updated Ace to the 12/2/13 build. 2013-12-09 11:43:13 -08: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
storage Add commands for "insert from file" and "word count". Fixed a bug where palette commands can't really 2014-02-20 09:00:29 -08:00
ui Raised the toast time, since it's nice for word count. 2014-02-21 17:50:12 -08:00
util Update readme with details of templating library and plugin 2014-01-22 08:52:13 -08:00
aceBindings.js Add async callbacks to a bunch of commands 2013-12-23 16:15:03 -08:00
api.js Add async callbacks to a bunch of commands 2013-12-23 16:15:03 -08:00
command.js Set up a valid init:complete event, process launch commands then. 2014-01-12 15:35:30 -08:00
editor.js Fixes #143 2014-02-21 20:29:41 -08:00
fileManager.js Fix a bug where syntax was detected but the dropdown wasn't set. 2014-02-21 20:46:28 -08:00
main.js main.js now uses Settings.pull() 2014-01-20 22:14:46 -08:00
readme.md readme changes 2014-01-20 23:36:30 -08:00
sessions.js Tweaks to inactive tab styles. 2014-02-21 21:13:20 -08:00
settings.js Add Settings.pull() for modules that want to request configs asynchronously instead of blocking load 2014-01-20 22:10:06 -08:00
tab.js Fix a bug where syntax was detected but the dropdown wasn't set. 2014-02-21 20:46:28 -08: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.

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.