Giter Club home page Giter Club logo

Comments (3)

jona10 avatar jona10 commented on June 2, 2024

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.

cnizzardini avatar cnizzardini commented on June 2, 2024

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.

cnizzardini avatar cnizzardini commented on June 2, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.