Skip to content

Commit 8745ca5

Browse files
fhunlethmattludwigs
authored andcommitted
Add nerves_uart to the list
Not everyone has switched their libraries from nerves_uart to circuits_uart and there's some really interesting stuff on hex.pm for nerves_uart. This adds it.
1 parent 1ceb9a6 commit 8745ca5

File tree

1 file changed

+17
-4
lines changed

1 file changed

+17
-4
lines changed

index.js

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,16 @@ var hexSearch = {
77
spiLibraries: [],
88
gpioLibraries: [],
99
uartLibraries: [],
10+
nervesUartLibraries: [],
1011
selectedLibraries: [],
1112
lastSearch: null,
1213
},
1314

1415
init: function () {
15-
var libraries = ["circuits_uart", "circuits_i2c", "circuits_gpio", "circuits_spi"];
16+
var libraries = ["circuits_uart", "circuits_i2c", "circuits_gpio", "circuits_spi", "nerves_uart"];
1617

1718
for (var i = 0; i < libraries.length; i++) {
18-
this.update("search", libraries[i], this.state);
19+
this.update("search", libraries[i], this.state);
1920
}
2021
},
2122

@@ -50,6 +51,10 @@ var hexSearch = {
5051
if (libSearched === "circuits_uart") {
5152
state.uartLibraries.push(lib);
5253
}
54+
55+
if (libSearched === "nerves_uart") {
56+
state.nervesUartLibraries.push(lib);
57+
}
5358
}
5459

5560
this.update("updateDom", null, state);
@@ -105,12 +110,17 @@ var hexSearch = {
105110
ul.appendChild(li);
106111
}
107112

113+
for (var i = 0; i < state.nervesUartLibraries.length; i++) {
114+
var li = this.buildLibListItem(state.nervesUartLibraries[i], "nerves_uart");
115+
ul.appendChild(li);
116+
}
117+
108118
var oldList = document.getElementById("js-hex-lib-list");
109119

110120
if (oldList) {
111121
state.avaliableLibrariesDom.removeChild(oldList);
112122
}
113-
123+
114124
state.avaliableLibrariesDom.appendChild(ul);
115125
},
116126

@@ -162,9 +172,12 @@ var hexSearch = {
162172
case "circuits_uart":
163173
return "uartLibraries";
164174
break;
175+
case "nerves_uart":
176+
return "nervesUartLibraries";
177+
break;
165178
}
166179
},
167-
180+
168181
}
169182

170183
window.addEventListener("load", function (event) {

0 commit comments

Comments
 (0)