Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Replace alert() with this.log(). #6

Merged
merged 1 commit into from

2 participants

Chris Barna Jonathan Soma
Chris Barna

I have an event on an input triggered on keyup to initialize a Tabletop object. When the input is deleted, Tabletop pops up it's alert. While alert is fine for local debugging, I don't think it should be used in a deployment.

Jonathan Soma
Owner

Hrm, what's your use case for initializing an empty Tabletop object? I personally like to err on the side of making it plenty hard for people to do things wrong, which is why I prefer an alert to a log. I'm open to changing it if a keyless object has something going for it, though.

Chris Barna

So I'm having users input a URL or key and currently have an event triggered by the input on "change" that creates a new Tabletop object. Admittedly, I can just wrap the object in an if statement checking for an empty string but I have a pretty serious aversion to alert() in production code. In practice, we'd never want the user to have to see it, even if they do something wrong. Totally your preference though.

Jonathan Soma jsoma merged commit 692226a into from
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Sep 7, 2012
  1. Chris Barna
This page is out of date. Refresh to see the latest.
Showing with 2 additions and 2 deletions.
  1. +2 −2 src/tabletop.js
4 src/tabletop.js
View
@@ -51,7 +51,7 @@
}
if(!this.key) {
- alert("You need to pass Tabletop a key!");
+ this.log("You need to pass Tabletop a key!");
return;
}
@@ -76,7 +76,7 @@
};
Tabletop.sheets = function() {
- alert("Times have changed! You'll want to use var tabletop = Tabletop.init(...); tabletop.sheets(...); instead of Tabletop.sheets(...)");
+ this.log("Times have changed! You'll want to use var tabletop = Tabletop.init(...); tabletop.sheets(...); instead of Tabletop.sheets(...)");
};
Tabletop.prototype = {
Something went wrong with that request. Please try again.