Ejemplo n.º 1
0
    /**
     * @constructor
     * @see LiveDocument
     * @param {LiveDevProtocol} protocol The protocol to use for communicating with the browser.
     * @param {function(string): string} urlResolver A function that, given a path on disk, should return
     *     the URL that Live Development serves that path at.
     * @param {Document} doc The Brackets document that this live document is connected to.
     * @param {?Editor} editor If specified, a particular editor that this live document is managing.
     *     If not specified initially, the LiveDocument will connect to the editor for the given document
     *     when it next becomes the active editor.
     */
    function LiveHTMLDocument(protocol, urlResolver, doc, editor) {
        LiveDocument.apply(this, arguments);

        this._instrumentationEnabled = false;
        this._relatedDocuments = {
            stylesheets: {},
            scripts: {}
        };

        this._onChange = this._onChange.bind(this);
        this.doc.on("change", this._onChange);

        this._onRelated = this._onRelated.bind(this);
        this.protocol.on("DocumentRelated", this._onRelated);

        this._onStylesheetAdded = this._onStylesheetAdded.bind(this);
        this.protocol.on("StylesheetAdded", this._onStylesheetAdded);

        this._onStylesheetRemoved = this._onStylesheetRemoved.bind(this);
        this.protocol.on("StylesheetRemoved", this._onStylesheetRemoved);

        this._onScriptAdded = this._onScriptAdded.bind(this);
        this.protocol.on("ScriptAdded", this._onScriptAdded);

        this._onScriptRemoved = this._onScriptRemoved.bind(this);
        this.protocol.on("ScriptRemoved", this._onScriptRemoved);

    }
Ejemplo n.º 2
0
    /**
     * @constructor
     * @see LiveDocument
     * @param {LiveDevProtocol} protocol The protocol to use for communicating with the browser.
     * @param {function(string): string} urlResolver A function that, given a path on disk, should return
     *     the URL that Live Development serves that path at.
     * @param {Document} doc The Brackets document that this live document is connected to.
     * @param {?Editor} editor If specified, a particular editor that this live document is managing.
     *     If not specified initially, the LiveDocument will connect to the editor for the given document
     *     when it next becomes the active editor.
     */
    function LiveHTMLDocument(protocol, urlResolver, doc, editor) {
        LiveDocument.apply(this, arguments);

        this._instrumentationEnabled = false;
        this._relatedDocuments = {
            stylesheets: {},
            scripts: {}
        };
        // XXXBramble: we force debug false to skip various console.log()s below.
        this._debug = false;
        this._onChange = this._onChange.bind(this);
        this.doc.on("change", this._onChange);

        this._onRelated = this._onRelated.bind(this);
        this.protocol.on("DocumentRelated", this._onRelated);

        this._onStylesheetAdded = this._onStylesheetAdded.bind(this);
        this.protocol.on("StylesheetAdded", this._onStylesheetAdded);

        this._onStylesheetRemoved = this._onStylesheetRemoved.bind(this);
        this.protocol.on("StylesheetRemoved", this._onStylesheetRemoved);

        this._onScriptAdded = this._onScriptAdded.bind(this);
        this.protocol.on("ScriptAdded", this._onScriptAdded);

        this._onScriptRemoved = this._onScriptRemoved.bind(this);
        this.protocol.on("ScriptRemoved", this._onScriptRemoved);

    }