@@ -58,15 +58,15 @@ define(function (require, exports, module) {
5858
5959
6060 // Status Codes
61- var STATUS_INACTIVE = exports . STATUS_INACTIVE = 0 ;
62- var STATUS_CONNECTING = exports . STATUS_CONNECTING = 1 ;
63- var STATUS_ACTIVE = exports . STATUS_ACTIVE = 2 ;
64- var STATUS_OUT_OF_SYNC = exports . STATUS_OUT_OF_SYNC = 3 ;
65- var STATUS_SYNC_ERROR = exports . STATUS_SYNC_ERROR = 4 ;
66- var STATUS_RELOADING = exports . STATUS_RELOADING = 5 ;
67- var STATUS_RESTARTING = exports . STATUS_RESTARTING = 6 ;
68-
69- var CommandManager = require ( "command/CommandManager" ) ,
61+ const STATUS_INACTIVE = exports . STATUS_INACTIVE = 0 ;
62+ const STATUS_CONNECTING = exports . STATUS_CONNECTING = 1 ;
63+ const STATUS_ACTIVE = exports . STATUS_ACTIVE = 2 ;
64+ const STATUS_OUT_OF_SYNC = exports . STATUS_OUT_OF_SYNC = 3 ;
65+ const STATUS_SYNC_ERROR = exports . STATUS_SYNC_ERROR = 4 ;
66+ const STATUS_RELOADING = exports . STATUS_RELOADING = 5 ;
67+ const STATUS_RESTARTING = exports . STATUS_RESTARTING = 6 ;
68+
69+ const CommandManager = require ( "command/CommandManager" ) ,
7070 Commands = require ( "command/Commands" ) ,
7171 Dialogs = require ( "widgets/Dialogs" ) ,
7272 DefaultDialogs = require ( "widgets/DefaultDialogs" ) ,
@@ -86,7 +86,7 @@ define(function (require, exports, module) {
8686 DefaultLauncher = require ( "LiveDevelopment/MultiBrowserImpl/launchers/Launcher" ) ;
8787
8888 // Documents
89- var LiveCSSDocument = require ( "LiveDevelopment/MultiBrowserImpl/documents/LiveCSSDocument" ) ,
89+ const LiveCSSDocument = require ( "LiveDevelopment/MultiBrowserImpl/documents/LiveCSSDocument" ) ,
9090 LiveHTMLDocument = require ( "LiveDevelopment/MultiBrowserImpl/documents/LiveHTMLDocument" ) ;
9191
9292 /**
@@ -96,6 +96,12 @@ define(function (require, exports, module) {
9696 */
9797 var _liveDocument ;
9898
99+ /**
100+ * Live preview only tracks the pinned document.
101+ * @type {boolean }
102+ */
103+ let livePreviewUrlPinned = false ;
104+
99105 /**
100106 * @private
101107 * Live documents related to the active HTML document - for example, CSS files
@@ -652,7 +658,7 @@ define(function (require, exports, module) {
652658 */
653659 function _onFileChange ( ) {
654660 var doc = DocumentManager . getCurrentDocument ( ) ;
655- if ( ! isActive ( ) || ! doc ) {
661+ if ( ! isActive ( ) || ! doc || livePreviewUrlPinned ) {
656662 return ;
657663 }
658664
@@ -875,6 +881,13 @@ define(function (require, exports, module) {
875881 }
876882 }
877883
884+ /**
885+ * @param urlPinned {boolean}
886+ */
887+ function setLivePreviewPinned ( urlPinned ) {
888+ livePreviewUrlPinned = urlPinned ;
889+ }
890+
878891 /**
879892 * Returns current project server config. Copied from original LiveDevelopment.
880893 */
@@ -897,15 +910,14 @@ define(function (require, exports, module) {
897910 }
898911
899912 // for unit testing only
900- function _getCurrentLiveDoc ( ) {
913+ function getCurrentLiveDoc ( ) {
901914 return _liveDocument ;
902915 }
903916
904917 EventDispatcher . makeEventDispatcher ( exports ) ;
905918
906919 // For unit testing
907920 exports . _server = _server ;
908- exports . _getCurrentLiveDoc = _getCurrentLiveDoc ;
909921 exports . _getInitialDocFromCurrent = _getInitialDocFromCurrent ;
910922
911923 // Export public functions
@@ -919,7 +931,9 @@ define(function (require, exports, module) {
919931 exports . redrawHighlight = redrawHighlight ;
920932 exports . init = init ;
921933 exports . isActive = isActive ;
934+ exports . setLivePreviewPinned = setLivePreviewPinned ;
922935 exports . getServerBaseUrl = getServerBaseUrl ;
936+ exports . getCurrentLiveDoc = getCurrentLiveDoc ;
923937 exports . getCurrentProjectServerConfig = getCurrentProjectServerConfig ;
924938 exports . setTransport = setTransport ;
925939 exports . setLauncher = setLauncher ;
0 commit comments