Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"trailingComma": "es5",
"tabWidth": 2,
"semi": true,
"singleQuote": true
}
4 changes: 2 additions & 2 deletions _data/topics.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[
{
"title": "Buffer and Streams",
"url": "/buffer-and-streams/"
"title": "Buffers and Streams",
"url": "/buffers-and-streams/"
},
{
"title": "Control flow",
Expand Down
8 changes: 4 additions & 4 deletions events/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,22 +17,22 @@ When the EventEmitter object emits an event, all of the functions attached to th
This example creates an event listener for `foo` events, and an event emitter to fire these events.

```javascript
const { EventEmitter } = require("events");
const { EventEmitter } = require('events');

// create a listener function. These can be arrow functions, but will
// loose `this` refering to the EventEmitter object
const foo = function foo() {
console.log("foo executed.", this);
console.log('foo executed.', this);
};

// create an emitter and bind some events to it
const eventEmitter = new EventEmitter();

// Bind the connection event with the listner1 function
eventEmitter.on("foo", foo);
eventEmitter.on('foo', foo);

// fire the event
eventEmitter.emit("foo");
eventEmitter.emit('foo');
```

## Passing parameters
Expand Down
22 changes: 11 additions & 11 deletions js/main.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
window.addEventListener("DOMContentLoaded", event => {
window.addEventListener('DOMContentLoaded', event => {
if (window.localStorage) {
window.topicsCompleted = getTopicsFromLocalStorage();
updateUI();
Expand All @@ -22,7 +22,7 @@ function checkForCompletedButtons() {
}

function getButtons() {
return document.querySelectorAll(".completed-button");
return document.querySelectorAll('.completed-button');
}

function toggleCompletedTopic(topic) {
Expand All @@ -40,17 +40,17 @@ function isCompleted(topic) {
}

function markButtonAsCompleted(button) {
button.classList.add("completed");
button.innerText = "Completed!";
button.classList.add('completed');
button.innerText = 'Completed!';
}

function markButtonAsNotCompleted(button) {
button.classList.remove("completed");
button.innerText = "Mark as completed";
button.classList.remove('completed');
button.innerText = 'Mark as completed';
}

function getTopicsFromLocalStorage() {
return JSON.parse(window.localStorage.getItem("topicsCompleted"));
return JSON.parse(window.localStorage.getItem('topicsCompleted'));
}

function addCompletedTopic(topic) {
Expand All @@ -64,7 +64,7 @@ function addCompletedTopic(topic) {

function save(topics) {
window.topicsCompleted = topics;
window.localStorage.setItem("topicsCompleted", JSON.stringify(topics));
window.localStorage.setItem('topicsCompleted', JSON.stringify(topics));
}

function removeCompletedTopic(topic) {
Expand All @@ -73,16 +73,16 @@ function removeCompletedTopic(topic) {
}

function getSidebarItems() {
return document.querySelectorAll(".topics li");
return document.querySelectorAll('.topics li');
}

function checkSideBar() {
[...getSidebarItems()].forEach(item => {
const topic = item.dataset.topic;
if (isCompleted(topic)) {
item.classList.add("completed");
item.classList.add('completed');
} else {
item.classList.remove("completed");
item.classList.remove('completed');
}
});
}
2 changes: 1 addition & 1 deletion styleguide/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ A paragraph (from the Greek paragraphos, “to write beside” or “written bes

```javascript
function whereTo() {
const foo = "bar";
const foo = 'bar';
for (let i = 0; i < 10; i++) {
console.log(foo);
}
Expand Down