Quantcast
Channel: JavaScriptMVC Forum
Viewing all articles
Browse latest Browse all 3491

Re : Temporarily disable routing

$
0
0
So I did some research on the code.. and it seems that you can simply do the following:

1) Initialize can.route as usual using can.route.ready()

2) Whenever you need to disable the routing, just run can.route._teardown(). The _ implies that it is meant for internal use only I guess, but it does the job, it unbinds the event but keeps the obersvable map intact, with all the routes.

3) Whenever you need to enable it again, run can.route._setup(). This will simply enable the bindings again. Alternatively, as I'm using it, you can run can.route.ready() again, which will run _setup, but also trigger something similar to a manual route request depending on the current url.

Members of canjs, please feel free to correct me, or come up with a more recommended use if you feel needed.

Viewing all articles
Browse latest Browse all 3491

Trending Articles