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

Commit aae3943

Browse files
committed
Added JSDoc description in WebSocketTransportDomain.js and used lodash instead of for loop in HTMLInstrumentation.js
1 parent dbe1329 commit aae3943

2 files changed

Lines changed: 12 additions & 6 deletions

File tree

src/LiveDevelopment/transports/node/WebSocketTransportDomain.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,13 @@
2121
*
2222
*/
2323

24+
/**
25+
* WebSocketTransportDomain creates a websocket server for Live Preview
26+
* It receives the message containing tagID from the Remote Client(onClick)
27+
* and emits an event which is listened by WebSocketTransport which
28+
* brings the cursor to the tag corresponding to that particular tagID
29+
*/
30+
2431
/*eslint-env node */
2532
/*jslint node: true */
2633
"use strict";

src/language/HTMLInstrumentation.js

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,8 @@ define(function (require, exports, module) {
5353

5454
var DocumentManager = require("document/DocumentManager"),
5555
HTMLSimpleDOM = require("./HTMLSimpleDOM"),
56-
HTMLDOMDiff = require("./HTMLDOMDiff");
56+
HTMLDOMDiff = require("./HTMLDOMDiff"),
57+
_ = require("thirdparty/lodash");
5758

5859
var allowIncremental = true;
5960

@@ -92,11 +93,9 @@ define(function (require, exports, module) {
9293
i,
9394
markFound;
9495

95-
for (i = 0; i < marks.length; i++) {
96-
if (marks[i].tagID === tagId) {
97-
markFound = marks[i];
98-
}
99-
}
96+
markFound = _.find(marks, function (mark) {
97+
return (mark.tagID === tagId);
98+
});
10099
if (markFound) {
101100
return markFound.find().from;
102101
} else {

0 commit comments

Comments
 (0)