Comments (3)
Hi,
I'm in somewhat the same situation as you, wanting to add and remove routes throughout the lifetime of the application.
The feature currently doesn't exist in Davis.js right now. I have written a workaround which can be found in the pull request #68 which adds a "destroy" function to the app.
The workaround, per say, consists as stopping, destroying, re-adding routes and re-starting the app. Not optimal, I know, but Oliver said that he'd be looking into adding the add/remove feature in the future.
Hope it helps,
Jonathan
from davis.js.
Oliver, can you at least explain where routes get stored so I can add in this feature myself? Looking at the code it appears routes go into routeCollection but I can't determine where this actually exists using the chrome console.
from davis.js.
It appears the following hack may work. It works by stuffing an instance of Davis into the window namespace and then referencing that object later on when you want to add routes. Here's an example:
window.CoreDavis = Davis(function () {
// all your this.get() calls here
})
then later on somewhere else in your application:
window.CoreDavis.get('/finished_goods/part_map',function(){
alert('omg a route!');
})
from davis.js.
Related Issues (20)
- POST routes defined within a scope don't work HOT 3
- Problem with getting hash routing to work HOT 6
- NodeJS / Express Server side Example?
- route matching not working in Firefox when JetBrains Add-on is isntalled
- request.isForPageLoad having issue while coming back to original server rendered url HOT 1
- AMD/UMD support HOT 2
- Route not found causes davis to stop HOT 1
- Redirection w/e req
- Combine hash routes with push state on single application
- Not supported Actively? HOT 7
- Cannot navigate within routes and manually to update URL
- [enhancement] Add missing bower.json. HOT 1
- How to refresh a page without doing a full window reload
- Semicolon delimited query parameters after the path causes route not to match
- davisjs.com gone HOT 2
- Does not properly handle not found routes with a target _blank attribute
- routeCollection is empty
- Davis Router is not working FirefoxOS HOT 1
- Problem with # routing in Davis Js HOT 1
- License Text
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from davis.js.