Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

update emily

  • Loading branch information...
commit 08a6c62262d89fc16dc0e07410883322e61fe7f8 1 parent 664e8e9
@podefr podefr authored
Showing with 11 additions and 12 deletions.
  1. +11 −12 lib/Emily.js
View
23 lib/Emily.js
@@ -1525,13 +1525,13 @@ function Transport() {
* MIT Licensed
*/
-define('Router',["Observable", "Store"],
+define('Router',["Observable", "Store", "Tools"],
/**
* @class
* Routing allows for navigating in an application by defining routes.
*/
-function Router(Observable, Store) {
+function Router(Observable, Store, Tools) {
return function RouterConstructor() {
@@ -1634,13 +1634,10 @@ function Router(Observable, Store) {
* @returns
*/
this.navigate = function get(route, params) {
- if (this.load(route, params)) {
+ if (this.load.apply(this, arguments)) {
// Before adding a new route to the history, we must clear the forward history
_history.proxy("splice", _currentPos +1, _history.count());
- _history.proxy("push", {
- route: route,
- params: params
- });
+ _history.proxy("push", Tools.toArray(arguments));
this.ensureMaxHistory(_history);
_currentPos = _history.count() -1;
return true;
@@ -1669,9 +1666,12 @@ function Router(Observable, Store) {
* Actually loads the route
* @private
*/
- this.load = function load(route, params) {
- if (_routes.notify(route, params)) {
- _events.notify("route", route, params);
+ this.load = function load() {
+ var copy = Tools.toArray(arguments);
+
+ if (_routes.notify.apply(_routes, copy)) {
+ copy.unshift("route");
+ _events.notify.apply(_events, copy);
return true;
} else {
return false;
@@ -1727,10 +1727,9 @@ function Router(Observable, Store) {
*/
this.go = function go(nb) {
var history = _history.get(_currentPos + nb);
-
if (history) {
_currentPos += nb;
- this.load(history.route, history.params);
+ this.load.apply(this, history);
return true;
} else {
return false;
Please sign in to comment.
Something went wrong with that request. Please try again.