From 2875e9f1b72a8ad8a14847e3a0667879fca8cb01 Mon Sep 17 00:00:00 2001 From: Peter Palotas Date: Sun, 28 Dec 2014 22:30:56 +0100 Subject: [PATCH] Added documentation to Marionette.AppRouter. Also made option keys optional since they are not mandatory. --- marionette/marionette.d.ts | 39 ++++++++++++++++++++++++++++++++++---- 1 file changed, 35 insertions(+), 4 deletions(-) diff --git a/marionette/marionette.d.ts b/marionette/marionette.d.ts index 31b9cbe52..d227ab606 100644 --- a/marionette/marionette.d.ts +++ b/marionette/marionette.d.ts @@ -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 {