Skip to content
This repository has been archived by the owner on Sep 6, 2021. It is now read-only.

Commit

Permalink
Fix bug #10200 (Live Preview throws errors on pages with dynamic LESS…
Browse files Browse the repository at this point in the history
…) - Make

sure every "live document" type implements the same interface, including the
EventDispatcher APIs.
  • Loading branch information
peterflynn committed Dec 17, 2014
1 parent 93cc73d commit 6d18e1e
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
4 changes: 4 additions & 0 deletions src/LiveDevelopment/Documents/CSSPreprocessorDocument.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ define(function CSSPreprocessorDocumentModule(require, exports, module) {
"use strict";

var _ = require("thirdparty/lodash"),
EventDispatcher = require("utils/EventDispatcher"),
CSSUtils = require("language/CSSUtils"),
EditorManager = require("editor/EditorManager"),
HighlightAgent = require("LiveDevelopment/Agents/HighlightAgent"),
Expand All @@ -62,6 +63,9 @@ define(function CSSPreprocessorDocumentModule(require, exports, module) {
this.onActiveEditorChange(null, EditorManager.getActiveEditor(), null);
};

// CSSPreprocessorDocument doesn't dispatch events, but the "live document" interface requires an on() API
EventDispatcher.makeEventDispatcher(CSSPreprocessorDocument.prototype);

/** Close the document */
CSSPreprocessorDocument.prototype.close = function close() {
this.doc.off(".CSSPreprocessorDocument");
Expand Down
10 changes: 7 additions & 3 deletions src/LiveDevelopment/Documents/JSDocument.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,10 @@
define(function JSDocumentModule(require, exports, module) {
"use strict";

var Inspector = require("LiveDevelopment/Inspector/Inspector");
var ScriptAgent = require("LiveDevelopment/Agents/ScriptAgent");
var HighlightAgent = require("LiveDevelopment/Agents/HighlightAgent");
var EventDispatcher = require("utils/EventDispatcher"),
Inspector = require("LiveDevelopment/Inspector/Inspector"),
ScriptAgent = require("LiveDevelopment/Agents/ScriptAgent"),
HighlightAgent = require("LiveDevelopment/Agents/HighlightAgent");

/**
* @constructor
Expand All @@ -68,6 +69,9 @@ define(function JSDocumentModule(require, exports, module) {
this.editor.on("cursorActivity", this.onCursorActivity);
this.onCursorActivity();
};

// JSDocument doesn't dispatch events, but the "live document" interface requires having an on() API
EventDispatcher.makeEventDispatcher(JSDocument.prototype);

/** Close the document */
JSDocument.prototype.close = function close() {
Expand Down

0 comments on commit 6d18e1e

Please sign in to comment.