3.0.0
These are core classes.
Application Context
Extends EventEmitter
All available classes
An instance of ContextMenuManager
Type: ContextMenuManager
An instance of KeymapManager
Type: KeymapManager
An instance of CommandManager
Type: CommandManager
An instance of ProjectManager
Type: ProjectManager
An instance of MetamodelManager
Type: MetamodelManager
An instance of Repository
Type: Repository
An instance of PreferenceManager
Type: PreferenceManager
An instance of SelectionManager
Type: SelectionManager
An instance of ClipboardManager
Type: ClipboardManager
An instance of DiagramManager
Type: DiagramManager
An instance of ExtensionLoader
Type: ExtensionLoader
An instance of SidebarView
Type: SidebarView
An instance of WorkingDiagramsView
Type: WorkingDiagramsView
An instance of ToolboxView
Type: ToolboxView
An instance of ModelExplorerView
Type: ModelExplorerView
An instance of StyleEditorView
Type: StyleEditorView
An instance of PropertyEditorView
Type: PropertyEditorView
An instance of DocumentationEditorView
Type: DocumentationEditorView
An instance of ToolbarView
Type: ToolbarView
An instance of ToolbarView
Type: StatusbarView
An instance of QuickeditManager
Type: QuickeditManager
An instance of DialogManager
Type: DialogManager
An instance of ToastManager
Type: ToastManager
An instance of PanelManager
An instance of ElementPickerDialog
An instance of ElementListPickerDialog
An instance of ElementListEditorDialog
Project Manager
This module dispatches these events:
Extends EventEmitter
A reference to repository
Return project
type.Project
:
New project
type.Project
:
Close project
Manages global application commands that can be called from menu items, key bindings, or subparts of the application.
This module dispatches these event(s):
Extends EventEmitter
Map of all registered global commands
Registers a global command.
(string)
unique identifier for command.
Core commands in app use a simple command title as an id, for example "open.file".
Extensions should use the following format: "author.myextension.mycommandname".
For example, "lschmitt.csswizard.format.css".
(function)
the function to call when the command is executed. Any arguments passed to
execute() (after the id) are passed as arguments to the function. If the function is asynchronous,
it must return a jQuery promise that is resolved when the command completes. Otherwise, the
CommandManager will assume it is synchronous, and return a promise that is already resolved.
Keymap Manager
A reference to an instance of CommandManager
Type: CommandManager
Add keymaps
(any)
Menu Manager
Clear menu template
Setup main menu.
Context Menu Manager
Metamodel Manager
Repository maintains a set of elements.
Reponsibilities:
This module dispatches these events:
Extends EventEmitter
An instance of OperationBuilder
Do an Operation If operation.bypass == true, the operation will not be pushed to UndoStack.
(Operation)
Undo
Redo
Clear all maps and stacks
Return an array of elements selected by selector expression. This is a quite heavy operation, so you need to concern about performance.
Selector expression - Children selector ex) Package1:: -- all children of Package1
- Type selector: "@<type>"
ex) Package1::@UMLClass
- Field selector: ".<field>"
ex) Class1.attributes, Package1.owendElements
- Value selector: "[field=value]"
ex) Class1.operations[isAbstract=false]
- Name selector: "<name>" (equivalent to "[name=<name>]")
ex) Class1, Class1::Attribute1
Selector examples:
(string)
Array<Element>
:
Search elements by keyword and type
(string)
(constructor)
Array<Element>
:
elements
Return the instance of OperationBuilder
OperationBuilder
:
Assign a value to a field. This will not insert an Operation into UndoStack (bypass = true). Use it carefully.
Engine
A reference to repository
Add a model element and a view element.
(Diagram)
Diagram where added views to be placed.
(Model)
Model element to be added.
(View)
View element to be added.
(Model)
Parent element to contain the model element
(string?)
Array field name of the parent (default = 'ownedElements')
(View?)
Container view where the view element to be contained (optional)
Move a parasitic view.
This module dispatches these events:
Extends EventEmitter
PreferenceManager only works in browser (it uses global localStorage object).
Extends EventEmitter
Preference Schema Map
Preference Item Map
Convenience function that sets a view state and then saves the file
Clipboard Manager
Clipboard Data
A reference to repository
Write clipboard to system clipboard
Read from system clipboard
Get Model from Clipboard (All elements are cloned from Clipboard)
Core.Model
:
Factory creates model, view and diagram elements
This module dispatches these events:
Extends EventEmitter
A reference to metamodels
A reference to repository
A reference to engine
A reference to diagramManager
Default function to create model and view elements.
Default function to create model and view elements of UndirectedRelationship.
Default function to create model and view elements of DirectedRelationship.
This module dispatches these events: - workingDiagramAdd: (diagram) - workingDiagramRemove: (diagram) - workingDiagramUpdate: (diagram) - currentDiagramChanged: (editor) - repaint: (editor) - mouseDown: (mouseEvent) - selectionChanged: (views) - viewDoubleClicked: (view, x, y) - viewMoved: (views, dx, dy) - parasiticViewMoved: (view, alpha, distance) - containerViewChanged: (views, dx, dy, containerView) - nodeResized: (node, left, top, right, bottom) - edgeModified: (edge, points) - edgeReconnected: (edge, points, newParticipant, isTailSide)
Extends EventEmitter
Save a list of working diagrams of current project.
Restore a list of working diagrams and current diagram of current project.
Close all diagrams except active diagram.
Close all diagrams
Return current diagram
Editor
:
Set next diagram as current diagram
Set previous diagram as current diagram
Return diagram editor.
Editor
:
Return Hidden Editor which is not shown
Select all view elements.
Deselect all.
Repaint.
Toggle grid
Show grid
Hide grid
These are core elements.
Element
Return a super type of a given type.
(constructor)
constructor
:
superType of subType
Return a generalized type of given elements.
constructor
:
Return Class. (equivalent to type[element.getClassName()])
constructor
:
Find an element by name. Find through ownedElements
chain, and then lookup through _parent
chain.
Element
:
Return the first matched element.
Model
Extends Element
Get a corresponding view type
constructor
:
Tag
Extends Model
Hyperlink
Extends Model
ExtensibleModel
Extends Model
Relationship
Extends ExtensibleModel
DirectedRelationship
Extends Relationship
RelationshipEnd
Extends ExtensibleModel
UndirectedRelationship
Extends Relationship
Type: RelationshipEnd
Type: RelationshipEnd
View
Extends Element
...
(any)
(any)
(any)
(any)
(any)
(any)
NodeView
Extends View
(any)
(any)
(any)
(any)
(any)
(any)
(any)
(any)
(any)
(any)
(any)
(any)
(any)
(any)
(any)
EdgeView
Extends View
(any)
(any)
(any)
(any)
(any)
(any)
(any)
(any)
(any)
(any)
(any)
(any)
(any)
(any)
(any)
(any)
(any)
(any)
(any)
(any)
(any)
(any)
(any)
(any)
(any)
(any)
(any)
(any)
(any)
(any)
(any)
LabelView
Extends NodeView
ParasiticView
Extends NodeView
NodeParasiticView
Extends ParasiticView
EdgeParasiticView
Extends ParasiticView
NodeLabelView
Extends NodeParasiticView
EdgeLabelView
Extends EdgeParasiticView
NodeNodeView
Extends NodeParasiticView
EdgeNodeView
Extends EdgeParasiticView
Diagram
Extends ExtensibleModel
Get a view of a specific model
(Model)
(constructor?)
View
:
Project
Extends ExtensibleModel
These are etc elements.
Maximum size of undo/redo stack
Type: number
Operator constants
Size-limited Stack
(any)
Reader Class
(Object)
(Object<string, constructor>)
Writer Class for storing Elements into JSON data.
OperationBuilder is used to build an operation
This module dispatches these events: - insert: (elem) - remove: (elem) - fieldAssign: (elem, field, val) - fieldInsert: (elem, field, val) - fieldInsertAt: (elem, field, val, pos) - fieldRemove: (elem, field, val) - fieldRemoveAt: (elem, field, val, pos) - fieldReorder: (elem, field, val, newPos) - fieldRelocate: (elem, field, oldParent, newParent)
Extends EventEmitter
Return timestamp
Finish to make an operation.
Discard currently making operation.
Validator
Clipboard Data Kinds
Type: string
Type: string
Get Registration Status
string
:
Set Registration Status
(any)
string
:
Get License Infomation
Object
:
Register LicenseKey
(any)
(string)
$.Promise
:
Validate LicenseKey
$.Promise
:
SidebarView
This contains ToolboxView and WorkingDiagramView
Toggle NavigatorView
Show NavigatorView
Hide NavigatorView
Return whether NavigatorView is visible or not
booean
:
WorkingDiagramsView
Positions shadow background elements to indicate vertical scrolling.
(!DOMElement)
the DOMElement that displays the shadow
(!Object)
the object that is scrolled
(!DOMElement)
div .scroller-shadow.top
(!DOMElement)
div .scroller-shadow.bottom
(boolean)
When using absolute position, top remains at 0.
Installs event handlers for updatng shadow background elements to indicate vertical scrolling.
(!DOMElement)
the DOMElement that displays the shadow. Must fire
"contentChanged" events when the element is resized or repositioned.
(Object?)
the object that is scrolled. Must fire "scroll" events
when the element is scrolled. If null, the displayElement is used.
(boolean?)
optionally show the bottom shadow
Remove scroller-shadow effect.
(!DOMElement)
the DOMElement that displays the shadow
(Object?)
the object that is scrolled
Utility function to replace jQuery.toggleClass when used with the second argument, which needs to be a true boolean for jQuery
Within a scrolling DOMElement, creates and positions a styled selection div to align a single selected list item from a ul list element.
Assumptions:
(any)
(!string)
A CSS class name on at most one list item in the contained list
(any)
(!DOMElement)
A DOMElement containing a ul list element
Determine how much of an element rect is clipped in view.
(!DOMElement)
A jQuery scrolling container
{top: number, right: number, bottom: number, left: number}
:
amount element rect is clipped in each direction
Within a scrolling DOMElement, if necessary, scroll element into viewport.
To Perform the minimum amount of scrolling necessary, cases should be handled as follows:
Assumptions:
(!DOMElement)
A jQuery scrolling container
(!DOMElement)
A jQuery element
(boolean?)
whether to also scroll horizontally
HTML formats a file entry name for display in the sidebar.
(!File)
File entry to display
string
:
HTML formatted string
Determine the minimum directory path to distinguish duplicate file names for each file in list.
(Array<File>)
list of Files with the same filename
Array<string>
:
directory paths to match list of files
This module dispatches these events: - elementCreated: (id, editor, x1, y1, x2, y2) - activeHandlerChanged: (handler)
Extends EventEmitter
Items
A reference to Repository
A refernce to DiagramManager
A reference to CommandManager
A reference to QuickeditManager
Add a toolbox template
(any)
Add a group.
(string)
(string)
(!Array<Core.Diagram>)
This group only available for these diagram types.
If empty array is passed, then this group will be available for any diagrams
(Array<Core.Diagram>)
This group will be automatically expands when one of these diagram types is activated
Show groups only available for a given diagram.
(Core.Diagram)
Toggle ToolboxView
Show ToolboxView
Hide ToolboxView
Return whether ToolboxView is visible or not
booean
:
Initialize when html-ready
Initialize when app-ready
MouseEvent
(any)
(any)
(any)
(any)
(any)
(any)
(any)
Handler
ManipulatorBinder
(any)
bind
(any)
ManipulatableNotifier
ContainmentHandlingProxy
SelectHandler Constants
Type: number
SelectHandler
Extends Handler
hasTheSameContainerView
(any)
isPointInSelectionLine
(any)
(any)
(any)
(any)
mouseDown
Seleting behavior
Moving behavior with multiple selected views
Manipulating bevaior with one selected view
(any)
(any)
(any)
(any)
(any)
(any)
(any)
(any)
(any)
CreateHandler
Extends Handler
(any)
(any)
(any)
(any)
(any)
(any)
(any)
(any)
(any)
(any)
(any)
(any)
Manipulator
(any)
(any)
(any)
(any)
(any)
(any)
(any)
(any)
(any)
(any)
(any)
(any)
(any)
(any)
(any)
(any)
(any)
(any)
NodeManipulator
Extends Manipulator
EdgeManipulator Constants
Type: number
EdgeManipulator
Extends Manipulator
(any)
(any)
(any)
(any)
(any)
(any)
(any)
(any)
(any)
(any)
(any)
(any)
(any)
(any)
ParasiticManipulator
Extends NodeManipulator
(any)
(any)
(any)
(any)
(any)
Diagram Editor
This class dispatches theses events: - selectionChanged: (views) - mouseDown: - viewDoubleClicked: (view, x, y) - viewMoved: (views, dx, dy) - parasiticViewMoved: (view, alpha, distance) - containerViewChanged: (views, dx, dy, containerView) - nodeResized: (node, left, top, right, bottom) - edgeModified: (edge, points) - edgeReconnected: (edge, points, newParticipant, isTailSide)
Extends EventEmitter
(any)
줌 팩터를 리턴
ZoomFactor
:
그리드 팩터를 리턴
GridFactor
:
This module dispatches these events: - selected: (elem) - doubleClicked: (elem) - dragOver: ({source, target, allow}); - dragOverDiagram: ({source, diagram, allow}); - drop: (source, target) - dropOnDiagram (source, diagram)
Extends EventEmitter
EditorsHolder
This contains StyleEditorView, PropertyEditorView, and DocumentationEditorView
Show styles of a given a list of views
This module dispatches these events: - propertyChanged: (element, field, value)
Extends EventEmitter
This module dispatches these events: - documentationChanged: (element, documentation)
Extends EventEmitter
Toolbar
StatusBar
Find a template item by a given id
Translate templates to Electron's menu template format
(any)
(any)
(any)
(any)
(Menu)
Pre-defined alias for context menu selectors
Color Object
Point class
Rect Class
Font
(any)
(any)
(any)
ZoomFactor
(any)
(any)
GridFactor
(any)
(any)
Points
Clear points
Reduce points for orthogonal line
Reduce points for line
Return wether is this rectilinear line or not
Convert oblique line to rectilinear line
Coordination utility object
transform value as a given zoonFactor
(any)
(any)
(any)
(any)
(any)
(any)
(any)
(any)
(any)
(any)
(any)
(any)
(any)
(any)
(any)
(any)
(any)
(any)
(any)
(any)
(any)
(any)
(any)
(any)
(any)
(any)
(any)
(any)
(any)
(any)
(any)
(any)
(any)
(any)
(any)
(any)
(any)
(any)
(any)
(any)
(any)
(any)
(any)
(any)
(any)
(any)
(any)
(any)
(any)
(any)
(any)
(any)
Canvas
(any)
Store current canvas state into a stack
Restore the canvas states from a stack
Transform (Scale)
Restore Transform
Draw a path. A path command is one of the followings:
['M', x, y] - moveTo
['L', x, y] - lineTo
['C', x1, y1, x2, y2, x, y] - bezierCurveTo
['Q', x1, y1, x, 2] - quadraticCurveTo
['Z'] - closePath
(any)
Graphic Utilities
Component definitions
Quickedit definitions
Active Quickedit
Keymap
KeydownHook
A reference to an instance of DiagramManager
A reference to an instance of Engine
A reference to an instance of KeymapManager
A reference to an instance of CommandManager
Add a quickedit template
(any)
Open a corresponding quickedit for the given view
Get the clicked end of EdgeView
string
:
'end1' | 'end2' | null
Close QuickEdit
(boolean)
Change Event
(any)
(any)
(any)
(any)
(any)
Click Event
(any)
(any)
(any)
Keydown Event
(any)
(any)
(any)
(any)
Open Event
(any)
(any)
Close Event
Get a new position at the top of a given area. The new position should be placed at the right most of given already existing nodes.
Get a new position at the bottom of a given area. The new position should be placed at the right most of given already existing nodes.
Get a new position at the left of a given area. The new position should be placed at the bottom most of given already existing nodes.
Get a new position at the right of a given area. The new position should be placed at the bottom most of given already existing nodes.
register QuickEdit
(Object)
Manages layout of panels surrounding the editor area, and size of the editor area (but not its contents).
Updates panel sizes when the window is resized. Maintains the max resizing limits for panels, based on currently available window size.
Events:
Calculates the available height for the full-size Editor (or the no-editor placeholder), accounting for the current size of all visible panels, toolbar, & status bar.
number
:
Updates panel resize limits to disallow making panels big enough to shrink editor area below 0
Calculates a new size for editor-holder and resizes it accordingly, then and dispatches the "editorAreaResize" event. (The editors within are resized by EditorManager, in response to that event).
(string?)
One of "skip", "force", or undefined. See EditorManager docs.
Trigger editor area resize whenever the window is resized
Trigger editor area resize whenever the given panel is shown/hidden/resized
(any)
Represents a panel below the editor area (a child of ".content").
(!jQueryObject)
The entire panel, including any chrome, already in the DOM.
(number?)
Minimum height of panel in px.
PanelManager
Creates a new panel beneath the editor area and above the status bar footer. Panel is initially invisible.
(!string)
Unique id for this panel. Use package-style naming, e.g. "myextension.feature.panelname"
(!jQueryObject)
DOM content to use as the panel. Need not be in the document yet.
(number?)
Minimum height of panel in px.
!Panel
:
Used by EditorManager to notify us of layout changes our normal panel/window listeners wouldn't detect. For internal use only: most code should call EditorManager.resizeEditor().
(any)
ToastManager
DataSource for ListView
The ExtensionManager fetches/caches the extension registry and provides information about the status of installed extensions. ExtensionManager raises the following events: statusChange - indicates that an extension has been installed/uninstalled or its status has otherwise changed. Second parameter is the id of the extension. registryUpdate - indicates that an existing extension was synchronized with new data from the registry.
Extension status constants.
Type: string
Extension location constants.
Type: string
Requested changes to the installed extensions.
Downloads the registry of Brackets extensions and stores the information in our extension info.
$.Promise
:
a promise that's resolved with the registry JSON data
or rejected if the server can't be reached.
Determines if the given versions[] entry is compatible with the given Brackets API version, and if not specifies why.
{isCompatible: boolean, requiresNewer: boolean?, compatibleVersion: string?}
:
Finds the newest version of the entry that is compatible with the given Brackets API version, if any.
(Object)
The registry entry to check.
(string)
The Brackets API version to check against.
{isCompatible: boolean, requiresNewer: boolean?, compatibleVersion: string?, isLatestVersion: boolean}
:
Result contains an "isCompatible" member saying whether it's compatible. If compatible, "compatibleVersion"
specifies the newest version that is compatible and "isLatestVersion" indicates if this is the absolute
latest version of the extension or not. If !isCompatible or !isLatestVersion, "requiresNewer" says whether
the latest version is incompatible due to requiring a newer (vs. older) version of Brackets.
Given an extension id and version number, returns the URL for downloading that extension from the repository. Does not guarantee that the extension exists at that URL.
string
:
The URL to download the extension from.
Removes the installed extension with the given id.
(string)
The id of the extension to remove.
$.Promise
:
A promise that's resolved when the extension is removed or
rejected with an error if there's a problem with the removal.
Removes the extension at the given path.
(string)
The absolute path to the extension to remove.
$.Promise
:
A promise that's resolved when the extension is removed, or
rejected if there was an error.
Implements the remove extension command.
(any)
(any)
Updates an installed extension with the given package file.
$.Promise
:
A promise that's resolved when the extension is updated or
rejected with an error if there's a problem with the update.
Implements the "update" command in the "extensions" domain.
Currently, this just wraps _cmdInstall, but will remove the existing directory first.
There is no need to call validate independently. Validation is the first thing that is done here.
After the extension is validated, it is installed in destinationDirectory unless the extension is already present there. If it is already present, a determination is made about whether the package being installed is an update. If it does appear to be an update, then result.installationStatus is set to NEEDS_UPDATE. If not, then it's set to ALREADY_INSTALLED.
If the installation succeeds, then result.installationStatus is set to INSTALLED.
The extension is unzipped into a directory in destinationDirectory with the name of the extension (the name is derived either from package.json or the name of the zip file).
The destinationDirectory will be created if it does not exist.
Deletes any temporary files left behind by extensions that were marked for update.
Unmarks all extensions marked for removal.
Marks an extension for later removal, or unmarks an extension previously marked.
Returns true if an extension is marked for removal.
(string)
The id of the extension to check.
boolean
:
true if it's been marked for removal, false otherwise.
Returns true if there are any extensions marked for removal.
boolean
:
true if there are extensions to remove
If a downloaded package appears to be an update, mark the extension for update. If an extension was previously marked for removal, marking for update will turn off the removal mark.
(Object)
info about the install provided by the Package.download function
Removes the mark for an extension to be updated on restart. Also deletes the downloaded package file.
(string)
The id of the extension for which the update is being removed
Returns true if an extension is marked for update.
(string)
The id of the extension to check.
boolean
:
true if it's been marked for update, false otherwise.
Returns true if there are any extensions marked for update.
boolean
:
true if there are extensions to update
Removes extensions previously marked for removal.
$.Promise
:
A promise that's resolved when all extensions are removed, or rejected
if one or more extensions can't be removed. When rejected, the argument will be an
array of error objects, each of which contains an "item" property with the id of the
failed extension and an "error" property with the actual error.
Updates extensions previously marked for update.
$.Promise
:
A promise that's resolved when all extensions are updated, or rejected
if one or more extensions can't be updated. When rejected, the argument will be an
array of error objects, each of which contains an "item" property with the id of the
failed extension and an "error" property with the actual error.
TODO: can this go away now that we never call it directly?
Validates the package at the given path. The actual validation is handled by the Node server.
The promise is resolved with an object: { errors: Array.<{string}>, metadata: { name:string, version:string, ... } } metadata is pulled straight from package.json and will be undefined if there are errors or null if the extension did not include package.json.
(any)
(any)
(string)
path to the package zip file
({requirePackageJSON: boolean?})
options
$.Promise
:
A promise that is resolved with information about the package
Implements the "validate" command in the "extensions" domain. Validates the zipped package at path.
The "err" parameter of the callback is only set if there was an unexpected error. Otherwise, errors are reported in the result.
The result object has an "errors" property. It is an array of arrays of strings. Each array in the array is a set of parameters that can be passed to StringUtils.format for internationalization. The array will be empty if there are no errors.
The result will have a "metadata" property if the metadata was read successfully from package.json in the zip file.
Validates and installs the package at the given path. Validation and installation is handled by the Node process.
The extension will be installed into the user's extensions directory. If the user already has the extension installed, it will instead go into their disabled extensions directory.
The promise is resolved with an object: { errors: Array.<{string}>, metadata: { name:string, version:string, ... }, disabledReason:string, installedTo:string, commonPrefix:string } metadata is pulled straight from package.json and is likely to be undefined if there are errors. It is null if there was no package.json.
disabledReason is either null or the reason the extension was installed disabled.
(string)
Absolute path to the package zip file
(string?)
Hint for the extension folder's name (used in favor of
path's filename if present, and if no package metadata present).
(boolean?)
private argument used to signal an update
$.Promise
:
A promise that is resolved with information about the package
(which may include errors, in which case the extension was disabled), or
rejected with an error object.
Implements the "install" command in the "extensions" domain.
There is no need to call validate independently. Validation is the first thing that is done here.
After the extension is validated, it is installed in destinationDirectory unless the extension is already present there. If it is already present, a determination is made about whether the package being installed is an update. If it does appear to be an update, then result.installationStatus is set to NEEDS_UPDATE. If not, then it's set to ALREADY_INSTALLED.
If the installation succeeds, then result.installationStatus is set to INSTALLED.
The extension is unzipped into a directory in destinationDirectory with the name of the extension (the name is derived either from package.json or the name of the zip file).
The destinationDirectory will be created if it does not exist.
Special case handling to make the common case of downloading from GitHub easier; modifies 'urlInfo' as needed. Converts a bare GitHub repo URL to the corresponding master ZIP URL; or if given a direct master ZIP URL already, sets a nicer download filename (both cases use the repo name).
Downloads from the given URL to a temporary location. On success, resolves with the path of the downloaded file (typically in a temp folder) and a hint for the real filename. On failure, rejects with an error object.
(string)
URL of the file to be downloaded
(number)
Unique number to identify this request
$.Promise
:
Attempts to synchronously cancel the given pending download. This may not be possible, e.g. if the download has already finished.
(number)
Identifier previously passed to download()
On success, resolves with an extension metadata object; at that point, the extension has already started running in Brackets. On failure (including validation errors), rejects with an error object.
An error object consists of either a string error code OR an array where the first entry is the error code and the remaining entries are further info. The error code string is one of either ExtensionsDomain.Errors or Package.Errors. Use formatError() to convert an error object to a friendly, localized error message.
The returned cancel() function will attempt to cancel installation, but it is not guaranteed to succeed. If cancel() succeeds, the Promise is rejected with a CANCELED error code. If we're unable to cancel, the Promise is resolved or rejected normally, as if cancel() had never been called.
(any)
{promise: $.Promise, cancel: function (): boolean}
:
Converts an error object as returned by install() or installFromURL() into a flattened, localized string.
string
:
Install an extension update located at path. This assumes that the installation was previously attempted and an installationStatus of "ALREADY_INSTALLED", "NEEDS_UPDATE", "SAME_VERSION", or "OLDER_VERSION" was the result.
This workflow ensures that there should not generally be validation errors because the first pass at installation the extension looked at the metadata and installed packages.
(string)
to package file
(string?)
Hint for the extension folder's name (used in favor of
path's filename if present, and if no package metadata present).
$.Promise
:
A promise that is resolved when the extension is successfully
installed or rejected if there is a problem.
Maps unique download ID to info about the pending download. No entry if download no longer pending. outStream is only present if we've started receiving the body.
Private function to remove the installation directory if the installation fails. This does not call any callbacks. It's assumed that the callback has already been called and this cleanup routine will do its best to complete in the background. If there's a problem here, it is simply logged with console.error.
(string)
Directory to remove
Private function to unzip to the correct directory.
(any)
(any)
(any)
(Function)
function that is called at the end of the unzipping
(string)
path to the package zip file
(string)
path to the destination directory for unzipping
(Object)
return value with the useful information for the client
Private function to remove the target directory and then install.
(any)
(any)
(any)
(Function)
function that is called at the end of the unzipping
(string)
path to the package zip file
(string)
path to the destination directory for unzipping
(Object)
return value with the useful information for the client
A "legacy package" is an extension that was installed based on the GitHub name without a package.json file. Checking for the presence of these legacy extensions will help users upgrade if the extension developer puts a different name in package.json than the name of the GitHub project.
(string)
directory to check for old-style extension.
Wrap up after the given download has terminated (successfully or not). Closes connections, calls back the client's callback, and IF there was an error, delete any partially-downloaded file.
Implements "downloadFile" command, asynchronously.
(any)
(any)
(any)
(any)
Implements "abortDownload" command, synchronously.
(any)
Returns true if the name presented is acceptable as a package name. This enforces the requirement as presented in the CommonJS spec: http://wiki.commonjs.org/wiki/Packages/1.0 which states:
"This must be a unique, lowercase alpha-numeric name without spaces. It may include "." or "_" or "-" characters."
We add the additional requirement that the first character must be a letter or number (there's a security implication to allowing a name like "..", because the name is used in directory names).
(string)
to test
boolean
:
true if the name is valid
Normalizes person fields from package.json.
These fields can be an object with name, email and url properties or a
string of the form "name
If an object other than a string is passed in, it's returned as is.
(any)
(any)
<String|Object> obj to normalize
Object
:
person object with name and optional email and url
Determines if any of the words in wordlist appear in str.
Array<String>
:
words that matched
Finds the common prefix, if any, for the files in a package file.
In some package files, all of the files are contained in a subdirectory, and this function will identify that directory if it exists.
Validates the contents of package.json.
Extracts the package into the given directory and then validates it.
Utilities for working with Promise, and other asynchronous processes.
Further ideas for Async utilities...
A "SuperDeferred" could feature some very useful enhancements:
(any)
(any)
(any)
Executes a series of tasks in parallel, returning a "master" Promise that is resolved once all the tasks have resolved. If one or more tasks fail, behavior depends on the failFast flag:
If nothing fails: (M = master promise; 1-4 = tasks; d = done; F = fail) M ------------d 1 >---d . 2 >------d . 3 >---------d . 4 >------------d
With failFast = false: M ------------F 1 >---d . . 2 >------d . . 3 >---------F . 4 >------------d
With failFast = true: -- equivalent to $.when() M ---------F 1 >---d . 2 >------d . 3 >---------F 4 >------------d (#4 continues even though master Promise has failed) (Note: if tasks finish synchronously, the behavior is more like failFast=false because you won't get a chance to respond to the master Promise until after all items have been processed)
To perform task-specific work after an individual task completes, attach handlers to each Promise before beginProcessItem() returns it.
Note: don't use this if individual tasks (or their done/fail handlers) could ever show a user- visible dialog: because they run in parallel, you could show multiple dialogs atop each other.
Promise
:
Executes a series of tasks in serial (task N does not begin until task N-1 has completed). Returns a "master" Promise that is resolved once all the tasks have resolved. If one or more tasks fail, behavior depends on the failAndStopFast flag:
If nothing fails: M ------------d 1 >---d . 2 >--d . 3 >--d . 4 >--d
With failAndStopFast = false: M ------------F 1 >---d . . 2 >--d . . 3 >--F . 4 >--d
With failAndStopFast = true: M ---------F 1 >---d . 2 >--d . 3 >--F 4 (#4 never runs)
To perform task-specific work after an individual task completes, attach handlers to each Promise before beginProcessItem() returns it.
$.Promise
:
Executes a series of tasks in parallel, saving up error info from any that fail along the way. Returns a Promise that is only resolved/rejected once all tasks are complete. This is essentially a wrapper around doInParallel(..., false).
If one or more tasks failed, the entire "master" promise is rejected at the end - with one argument: an array objects, one per failed task. Each error object contains:
$.Promise
:
Value passed to fail() handlers that have been triggered due to withTimeout()'s timeout
Adds timeout-driven failure to a Promise: returns a new Promise that is resolved/rejected when the given original Promise is resolved/rejected, OR is rejected after the given delay - whichever happens first.
If the original Promise is resolved/rejected first, done()/fail() handlers receive arguments piped from the original Promise. If the timeout occurs first instead, fail() is called with the token Async.ERROR_TIMEOUT.
($.Promise)
(number)
$.Promise
:
Format a string by replacing placeholder symbols with passed in arguments.
Example: var formatted = StringUtils.format("Hello {0}", "World");
(string)
The base string
string
:
Formatted string
Splits the text by new line characters and returns an array of lines
(string)
Array<string>
:
lines
Returns a line number corresponding to an offset in some text. The text can be specified as a single string or as an array of strings that correspond to the lines of the string.
Specify the text in lines when repeatedly calling the function on the same text in a loop. Use getLines() to divide the text into lines, then repeatedly call this function to compute a line number from the offset.
(number)
number
:
line number
Returns true if the given string ends with the given suffix.
Handles the keyDown event for the dialogs
($.Event)
(boolean)
boolean
:
DialogManager
Immediately closes any dialog instances with the given class. The dialog callback for each instance will be called with the special buttonId DIALOG_CANCELED (note: callback is run asynchronously).
Show Font Dialog
(Graphics.Font)
Initial font
Dialog
:
Element Picker Dialog
Element List Picker Dialog
Element List Editor Dialog
Show About Dialog
Dialog
:
Show Preference Dialog
(string)
Dialog
:
Show License Manager Dialog
Dialog
:
Show Print Dialog
Dialog
:
({install: function (url), cancel: function ()})
The installer backend to use.
(any)
Initialize and show the dialog.
(string?)
If specified, immediately starts installing the given file as if the user had
specified it.
$.Promise
:
A promise object that will be resolved when the selected extension
has finished installing, or rejected if the dialog is cancelled.
Mediates between this module and the Package extension-installation utils. Mockable for unit-testing.
Initializes the view to show a set of extensions.
(ExtensionManagerViewModel)
Model object containing extension data to view
$.Promise
:
a promise that's resolved once the view has been initialized. Never
rejected.
Gets the last version from the given object and returns the short form of its date. Assumes "this" is the current template context.
string
:
The formatted date.
Returns a more friendly display form of the owner's internal user id. Assumes "this" is the current template context.
string
:
A display version in the form "id (service)".
Given a registry item, returns a URL that represents its owner's page on the auth service. Currently only handles GitHub. Assumes "this" is the current template context.
string
:
A link to that user's page on the service.
Given a registry item, formats the author information, including a link to the owner's github page (if available) and the author's name from the metadata.
Returns an array of current registry entries, sorted by the publish date of the latest version of each entry.
(object)
The unsorted registry.
(string)
The subkey to look for the registry metadata in. If unspecified, assumes
we should look at the top level of the object.
Array
:
Sorted array of registry entries.
Unregisters listeners when we're done.
Initializes the model from the source.
Initializes the model from the set of locally installed extensions, sorted alphabetically by id (or name of the extension folder for legacy extensions).
$.Promise
:
a promise that's resolved when we're done initializing.
ExtensionLoader searches the filesystem for extensions, then creates a new context for each one and loads it. This module dispatches the following events: "load" - when an extension is successfully loaded. The second argument is the file path to the extension root. "loadFailed" - when an extension load is unsuccessful. The second argument is the file path to the extension root.
Returns the full path of the default user extensions directory. This is in the users
application support directory, which is typically
/Users/
Loads the extension that lives at baseUrl
Loads the extension that lives at baseUrl into its own Require.js context
Load extensions.
Convert between URL querystring and name/value pairs. Decodes and encodes URL parameters.
Appends a