swipely / aviator Goto Github PK
View Code? Open in Web Editor NEWAviator is a single-page front-end router built for modularity.
License: MIT License
Aviator is a single-page front-end router built for modularity.
License: MIT License
I'm pretty sure I should import something from somewhere before using Aviator.setRoutes, but you don't seem to have put it in the docs!
We're used to always having '/partners' - but when no root is specified (and it defaults to ""
), you get an invalid RegEx from this guy:
/**
@method _removeURIRoot
@param {String} uri '/partners/s/foo-bar'
@return {String} uri '/s/foo-bar'
**/
_removeURIRoot: function (uri) {
var rootRegex = new RegExp('^' + this.root);
return uri.replace(rootRegex, '');
}
Could you guys setup a cdn that people can just hit for simple front-end environments?
Given this code:
var Handler = {
index: function(req) {
console.log(req);
}
};
Aviator.pushStateEnabled = false;
Aviator.setRoutes({
'/users': {
target: Handler,
'/': 'index'
},
'/cats/:id': {
target: Handler,
'/': 'index'
}
});
Aviator.dispatch();
Aviator.navigate('/users?foo=bar');
I get a Uncaught TypeError: Cannot read property 'indexOf' of undefined (aviator.js:898)
.
But if I comment out the pushStateEnabled = false
, it works as expected.
It should be allowed to provide the following config and have use the nearest ancestral route target:
Aviator.setRoutes({
'/articles': {
target: articleRouteTarget,
'/comments': {
'/:id': 'showComment'
}
}
});
Every request has a matchedRoute
property but it only includes what is currently matched up to the route target being executed.
We should try to include the entirity of the route. Cases where we need to conditionally redirect, or exit are currently potentially limited. Ie. prompt for a login and return to the proper route on success.
No mention of what is being passed to a route target.
The README mentions navigating to a named link parameter but doesn't include an example of one in Aviator.setRoutes
or a route target.
In the above case, hitting "/campaigns/add" would call the add method on the on the MarketingTarget.
This should be CampaignsTarget.
Hello,
Aviator works fine for me, just got a problem to handle initial url.
When I run 'http://127.0.0.1/', and then use navigate to /foo, it's ok, but when I directly access, for instance, http://127.0.0.1/foo (loading this url) I get a 404. How can you get rid of that using Aviator ?
Cheers
I checked NPM and hit a google search; there doesn't seem to be a packaged module or aviator available. Are there plans to publish it to npm?
Currently a routeLevel defined like this:
'/path': {
'/:category': 'index',
'/another_level': 'another_action'
}
and a route like this: /path/another_level
will not result in the expected behavior. The route matcher assumes that another_level
is the namedParam value for category
Given this code:
var Handler = {
index: function(req) {
console.log(req);
}
};
Aviator.pushStateEnabled = false;
Aviator.setRoutes({
'/users': {
target: Handler,
'/': 'index',
'/:id': 'index'
}
});
Aviator.dispatch();
Aviator.navigate('/users/123?foo=bar');
I get a Request object with queryParams
empty and queryString
null?
If I comment out the line Aviator.pushStateEnabled = false
though, I get the expected Request object, with the query string parsed properly.
I was testing this in Chrome 34. Any ideas what's going on?
Thanks!
I have an anchor points to a page like href="foo.html?bar=baz"
and I really need that query string. Unfortunately, it got ignored in the navigator.
Good docs. Some demos would be nice too to demonstrate some best practices.
https://gist.github.com/hojberg/9549330
Found a react demo for reference but none others...
Currently to match:
'/retention': {
target: targets.menuRetentionRouteTarget,
'/*': 'beforeAll',
'/': 'index'
},
one has to write it as:
'/retention': {
target: targets.menuRetentionRouteTarget,
'/*': 'beforeAll',
'/': {
target: targets.menuRetentionRouteTarget,
'/': 'index'
}
},
multiple slashes per route target does not have namedParams in the Request object
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.