4.3 KiB
Developer guide
Architecture
StackEdit uses RequireJS for asynchronous module definition (AMD).
core
The core
module is responsible for:
- creating the layout (using UI Layout)
- creating the editor (using PageDown)
- loading/saving the settings
- running period tasks
- detecting the user activity
- checking the offline status
fileMgr
The fileMgr
module is responsible for:
- creating and deleting local files
- switching from one file to another
FileDescriptor
The FileDescriptor
class represents a local file. A FileDescriptor
object has the following properties:
fileIndex
: the unique string index of the file in the file systemtitle
: the title of the documentcontent
: the content of the documentsyncLocations
: a map containing all the associatedsyncAttributes
objects with theirsyncIndex
as a keypublishLocations
: a map containing all the associatedpublishAttributes
objects with theirpublishIndex
as a key
And the following methods:
addSyncLocation(syncAttributes)
: associates asyncAttributes
object with the fileremoveSyncLocation(syncAttributes)
: unassociates asyncAttributes
object with the fileaddPublishLocation(publishAttributes)
: associates apublishAttributes
object with the fileremovePublishLocation(publishAttributes)
: unassociates apublishAttributes
object with the file
fileSystem
The fileSystem
module is a map containing all the FileDescriptor
objects with their fileIndex
as a key
synchronizer
The synchronizer
module is responsible for:
- creating a new local file from a sync location (import)
- creating a new sync location from a local file (export)
- running 2 ways synchronization (upload and download) for all sync locations
synchronizer's providers
A provider
module can be associated with the synchronizer
module if it implements the following functions:
importFiles()
: downloads one or multiple files and create local files associated with the sync locationsexportFile()
: uploads a local file to a new sync locationsyncDown()
: performs a download of all the changes operated on all sync locationssyncUp()
: performs an upload of a change to a sync location
syncAttributes
A syncAttributes
object is an object that describes a sync location. Attributes differ from one provider to another except for the following:
syncIndex
: the unique string index of the publish locationprovider
: theprovider
module that handles the sync location
publisher
The publisher
module is responsible for:
- creating new publish locations
- updating existing publish locations
publisher's providers
A provider
module can be associated with the publisher
module if it implements the following functions:
newPublishAttributes()
: returns a newpublishAttributes
object in order to create a new publish locationpublish()
: performs publishing of one publish location
publishAttributes
A publishAttributes
object is an object that describes a publish location. Attributes differ from one provider to another except for the following:
publishIndex
: the unique string index of the publish locationprovider
: theprovider
module that handles the publish locationformat
: the publishing format for the publish location. It can be:markdown
for Markdown formathtml
for HTML formattemplate
for template format
provider
Written with StackEdit.