[Pkg-javascript-commits] [backbone] 65/211: Throw an error if Backbone.history.start is called twice.
Jonas Smedegaard
js at moszumanska.debian.org
Sat May 3 17:00:03 UTC 2014
This is an automated email from the git hooks/post-receive script.
js pushed a commit to tag 0.5.0
in repository backbone.
commit f1e0f6b5c18f7f347eca6c67767381f77490faee
Author: Jeremy Ashkenas <jashkenas at gmail.com>
Date: Mon Feb 7 10:28:13 2011 -0500
Throw an error if Backbone.history.start is called twice.
---
backbone.js | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/backbone.js b/backbone.js
index 8c2309a..8cf40f1 100644
--- a/backbone.js
+++ b/backbone.js
@@ -709,6 +709,9 @@
// Cached regex for cleaning hashes.
var hashStrip = /^#*/;
+ // Has the history handling already been started?
+ var historyStarted = false;
+
// Set up all inheritable **Backbone.History** properties and methods.
_.extend(Backbone.History.prototype, {
@@ -724,6 +727,7 @@
// Start the hash change handling, returning `true` if the current URL matches
// an existing route, and `false` otherwise.
start : function() {
+ if (historyStarted) throw new Error("Backbone.history has already been started.");
var docMode = document.documentMode;
var oldIE = ($.browser.msie && (!docMode || docMode <= 7));
if (oldIE) {
@@ -734,6 +738,7 @@
} else {
setInterval(this.checkUrl, this.interval);
}
+ historyStarted = true;
return this.loadUrl();
},
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/backbone.git
More information about the Pkg-javascript-commits
mailing list