interface IDocument {
// Properties
readonly ${name}: string;
${size}: number;
readonly ${views}: ${IDocumentView}[];
// Methods
${saveAsync}(forceBackup = false): Promise<void>;
${saveAsAsync}(path: string, format?: string): Promise<void>;
${undo}(steps = 1): void;
${redo}(steps = 1): void;
${cancel}(): void;
${close}(closeMode = ${CloseMode}.Prompt): boolean;
}
// This interface is not available in managed environment
// This interface is not available in native environment
readonly name: string;
// This property is not available in managed environment
// This property is not available in native environment
Returns current document's name. Maybe empty if the document was created using newDocument method. The following information is returned, depending on document's type:
Type | Name |
---|---|
File, encoded file | Full path to the file. |
Volume, physical disk | Either the full path to device, or device's friendly name. |
size: number;
// This property is not available in managed environment
// This property is not available in native environment
This property returns the current document size. You can assign a new value to this property to change the size of the document. This operation creates a record in document operation history.
var document = newDocument();
document.size = 100;
readonly views: ${IDocumentView}[];
// This property is not available in managed environment
// This property is not available in native environment
This property holds an array of all document views.
var document = newDocument();
activate(document.views[0]);
saveAsync(forceBackup = false): Promise<void>;
// This method is not available in managed environment
// This method is not available in native environment
forceBackup
true
to force creation of a backup.A promise object that gets completed when save operation finishes. If save operation fails, promise is completed with an exception.
Saves the changes made to the document. If the document does not have a name yet, a user is prompted to select the target.
saveAsAsync(path: string, format?: string): Promise<void>;
// This method is not available in managed environment
// This method is not available in native environment
path
format
A promise object that gets completed when save operation finishes. If save operation fails, promise is completed with an exception.
Saves a copy of the document to the specified file. Optional format
parameter may override the original document format:
Format | Description |
---|---|
"binary" | Save as a normal file. |
"intel-hex" | Save as Intel Hex encoded file. |
"motorola-hex" | Save as Motorola S-Records encoded file. |
undo(steps = 1): void;
// This method is not available in managed environment
// This method is not available in native environment
steps
Undoes the given number of steps in the document's operation history.
redo(steps = 1): void;
// This method is not available in managed environment
// This method is not available in native environment
steps
Redoes (repeats) the given number of steps in the document's operation history.
cancel(): void;
// This method is not available in managed environment
// This method is not available in native environment
Cancel an ongoing asynchronous operation. If an asynchronous operation is actually running, it is completed with an exception.
close(closeMode = ${CloseMode}.Prompt): boolean;
// This method is not available in managed environment
// This method is not available in native environment
closeMode
true
if the document has been closed successfully, false
otherwise.
Closes the document and all its document views. Optional closeMode
parameter is used if the document has unsaved changes:
Value | Description |
---|---|
Prompt | Ask the user to save changes. The user can choose “yes”, “no” or “cancel”. In the latter case, close returns false . |
Save | Save unsaved changes. |
Discard | Discard unsaved changes. |