src/document/Document.js
function Document(file, initialTimestamp, rawText) {
        this.file = file;
        this.editable = !file.readOnly;
        this._updateLanguage();
        this.refreshText(rawText, initialTimestamp, true);
        // List of full editors which are initialized as master editors for this doc.
        this._associatedFullEditors = [];
    }
function Document(file, initialTimestamp, rawText) {
        this.file = file;
        this.editable = !file.readOnly;
        this._updateLanguage();
        this.refreshText(rawText, initialTimestamp, true);
        // List of full editors which are initialized as master editors for this doc.
        this._associatedFullEditors = [];
    }
function Document ( file , initialTimestamp , rawText ) { this . file = file ; this . editable = ! file . readOnly ; this . _updateLanguage ( ) ; this . refreshText ( rawText , initialTimestamp , true ) ; // List of full editors which are initialized as master editors for this doc. this . _associatedFullEditors = [ ] ; }
Model for the contents of a single file and its current modification state.
See DocumentManager documentation for important usage notes.

Document dispatches these events:

__change__ -- When the text of the editor changes (including due to undo/redo).

Passes ({Document}, {ChangeList}), where ChangeList is an array
of change record objects. Each change record looks like:

{ from: start of change, expressed as {line: <line number>, ch: <character offset>},
to: end of change, expressed as {line: <line number>, ch: <chracter offset>},
text: array of lines of text to replace existing text }

The line and ch offsets are both 0-based.

The ch offset in "from" is inclusive, but the ch offset in "to" is exclusive. For example,
an insertion of new content (without replacing existing content) is expressed by a range
where from and to are the same.

If "from" and "to" are undefined, then this is a replacement of the entire text content.

IMPORTANT: If you listen for the "change" event, you MUST also addRef() the document
(and releaseRef() it whenever you stop listening). You should also listen to the "deleted"
event.

__deleted__ -- When the file for this document has been deleted. All views onto the document should
be closed. The document will no longer be editable or dispatch "change" events.

__languageChanged__ -- When the value of getLanguage() has changed. 2nd argument is the old value,
3rd argument is the new value.

@constructor
@param {!File} file  Need not lie within the project.
@param {!Date} initialTimestamp  File's timestamp when we read it off disk.
@param {!string} rawText  Text content of the file.
Model for the contents of a single file and its current modification state . See DocumentManager documentation for important usage notes .