Errata: 1st Edition

Chapter 10, page 221, in the section Registering createOrder as a submit handler

The third paragraph of that section instructs the reader to update formhandler.js.
The file that should be changed is main.js.

1 Like

Chapter 13, page 270, in the section Using jQuery’s $.ajax method

The last code listing on the page shows a call to remoteDS.getAll().

At this point, getAll expects a callback, and should be invoked like so:

remoteDS.getAll(function (data) { console.log(data); });

Chapter 13, page 272, in the section Replacing DataStore with RemoteDataStore

The following line should not appear in the last two code listings:

var webshim = window.webshim;

This code was part of the For the More Curious: The Webshims Library section on page 255.

Chapter 14, page 285, in the section Using Deferreds with Callback-Only APIs

The final code listing on the page has references to a webshim object.
These two lines should be ignored.

That listing should be:

...
  formHandler.addInputHandler(Validation.isCompanyEmail);

  myTruck.printOrders(checkList.addRow.bind(checkList));
})(window);

This code was part of the For the More Curious: The Webshims Library section on page 255.

Chapter 14, page 290, in the section Promise-ifying the other DataStore methods

The final code listing on the page has a reference to a webshim object. This line should be ignored.

This code was part of the For the More Curious: The Webshims Library section on page 255.

Chapter 14, page 289, in the section Promise-ifying the other DataStore methods

The last code listing on the page shows what code to remove from DataStore.prototype.add.

The line this.data[key] = val; should not be removed.

The final version of DataStore.prototype.add should be as follows:

DataStore.prototype.add = function (key, val) {
  this.data[key] = val;
  return promiseResolvedWith(null);
};
1 Like

Chapter 16, page 319, in the section Creating the Chat Server Functionality

There is a semi-colon missing from the line clientSocket.send(data).

The newly added lines should be:

ws.clients.forEach(function (clientSocket) {
  clientSocket.send(data);
});
1 Like

Chapter 17, page 336, in the section Adding the ChatMessage Class

When the serialize method is added, it shows an older version of the constructor method.

The entire code listing should appear as follows:

...
class ChatMessage {
  constructor({
    message: m,
    user: u='batman',
    timestamp: t=(new Date()).getTime()
  }) {
    this.message = m;
    this.user = u;
    this.timestamp = t;
  }
  serialize() {
    return {
      user: this.user,
      message: this.message,
      timestamp: this.timestamp
    };
  }
}

export default ChatApp;
1 Like

Chapter 18, pages 353 and 355, in the section Using Gravatars

Screenshots 18.2 and 18.4 are incorrect. At this point in the book, a user is not yet being passed to the ChatMessage constructor. Therefore, the screenshots should show the default username of 'batman'.

1 Like

Chapter 21, page 407, Silver Challenge

Ember already includes the isNew Boolean attribute to models.
Adding it manually will cause errors.

Chapter 24, page 445, Editing a Sighting

On the fifth line of the first code listing, there is a typo.

The line

{{moment-from model.sightin.sightedAt}}

Should be

{{moment-from model.sighting.sightedAt}}

Chapter 25, page 464, Actions Up

The first code listing instructs the reader to add

close=(action "removeAlert")

In Ember 2.4.3, the action helper doesn’t work for controller or route actions. Instead, use sendAction in the component, and set close=“removeAlert”

The correct page number is 288.

Chapter 11, page 236.

Could also work without the call method, as follows:

formHandler.addSubmitHandler(function (data) {
    myTruck.createOrder(data, myTruck);
    checkList.addRow(data, checkList);
});

Chapter 7, on page 157 and 158, in the section Custom Timing Functions
.detail-image-frame{
position : relative;
text-align: center

transition: transform 333m cubic-bezier(1, .06, .28, 1);

}

the transition time should be “ms” not “m”, as “m” will throw an error in Atom’s css linter and not render any transition at all in browser.
.detail-image-frame{
position : relative;
text-align: center

transition: transform 333ms cubic-bezier(1, .06, .28, 1);

}

Chapter 17, page 335, Adding the ChatMessage Class

The example call to the ChatMessage constructor is incorrect.
The = should be replaced with :

Specifically, this:

new ChatMessage({message: 'hello from the outside',
                 user='adele25@bignerdranch.com', timestamp=1462399523859});

should be:

new ChatMessage({message: 'hello from the outside',
                 user: 'adele25@bignerdranch.com', timestamp: 1462399523859});

this.chatForm.init((data) => {
let message = new ChatMessage({message: data});
socket.sendMessage(message.serialize());
});

Just a minor typo I came across in chapter 3 (page 44/45 - PDF version): Just before Figure 3.12 Prompting for a style rule the text instructs to make changes to the section elements.style in the Chrome DevTools. However, in Chrome (and the relevant screenshots), the section is called element.style (without the s)

1 Like

Chapter 25, page 261

alertType: null causes an error for me, since null is not a string and so cannot be capitalized. In our removeAlert() action, when removing an alert we reset the alertType to “success”, so I’ve done the same in my code, so the code added at the top of page 261 would be

alertMessage: null, alertType: "success", isAlertShowing: false

I could well be doing something wrong with sendAction but what got this working for me was as follows:
Insert action="removeAlert" instead of close=(action "removeAlert")
Then in app/components/flash-alert.js replace this.get('close')(); with just this.sendAction(); .

Now the message displays and hides as I’d expect.