Added documentation to Marionette.AppRouter. Also made option keys optional since they are not mandatory.

This commit is contained in:
Peter Palotas
2014-12-28 22:30:56 +01:00
parent ad8e1cc5d6
commit 2875e9f1b7
+35 -4
View File
@@ -1087,16 +1087,47 @@ declare module Marionette {
}
interface AppRouterOptions extends Backbone.RouterOptions {
appRoutes: any;
controller: any;
/**
* The appRoutes.
*/
appRoutes?: any;
/**
* The controller to associate with this router.
*/
controller?: any;
}
/**
* Reduce the boilerplate code of handling route events and then calling a
* single method on another object. Have your routers configured to call
* the method on your object, directly.
*/
class AppRouter extends Backbone.Router {
/**
* Configure an AppRouter with appRoutes. The route definition
* is passed on to Backbone's standard routing handlers. This means
* that you define routes like you normally would. However, instead of
* providing a callback method that exists on the router, you provide a
* callback method that exists on the controller, which you specify for
* the router instance (see below.)
*/
constructor(options?: AppRouterOptions);
processAppRoutes(controller: any, appRoutes: any);
appRoute(route: string, methodName: string): void;
/**
* You can specify a controller with the multiple routes at runtime with
* this method. However, In this case the current controller of AppRouter
* will not change.
*/
processAppRoutes(controller: any, appRoutes: any);
/**
* Adds an app route at runtime to this instance. It works the same as the
* built-in router.route() call from Backbone's Router, but has all the
* same semantics and behavior of the appRoutes configuration.
*/
appRoute(route: string, methodName: string): void;
}
class Application extends Backbone.Events {