From d9ac108ab6321d3bf8dedc025f1e81139ec6818e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonathan=20Hedr=C3=A9n?= Date: Mon, 28 Oct 2013 14:01:55 +0100 Subject: [PATCH] Added DEBUG interface. Fixed Advice/Component/Base inheritance. --- flight/flight-tests.ts | 2 +- flight/flight.d.ts | 101 +++++++++++++++++++++++------------------ 2 files changed, 57 insertions(+), 46 deletions(-) diff --git a/flight/flight-tests.ts b/flight/flight-tests.ts index 69daaaad2..5e7b69393 100644 --- a/flight/flight-tests.ts +++ b/flight/flight-tests.ts @@ -4,7 +4,7 @@ declare var els: Element[]; declare var mixinFn: Function; function TestComponent() { - var self: Flight.Base = this; + var self: Flight.Component = this; self.defaultAttrs({ fooSelector: '.bar' diff --git a/flight/flight.d.ts b/flight/flight.d.ts index 9e742d62e..18df3ec6c 100644 --- a/flight/flight.d.ts +++ b/flight/flight.d.ts @@ -7,51 +7,7 @@ declare module Flight { - export interface Advice { - /** - * Run the customFunc function after the existingFunc function. - * - * @param existingFuncName The name of the existing function (existingFunc) - * you want to augment. - * - * customFunc The function to be invoked after existingFunc. - */ - after(method: string, fn: Function); - - /** - * Run the existingFunc function in the middle of the customFunc function. - * It's similar to underscore's _wrap function). - * - * @param existingFuncName The name of the existing function (existingFunc) - * you want to augment. - * - * customFunc The function to wrap around existingFunc. The existingFunc - * function will be passed to customFunc as an argument. - * - * The existing function is passed to the custom function as an argument so - * that it can be referenced. If the custom function does not call the - * existing function then it will replace that function instead of - * surrounding it. - */ - around(method: string, fn: Function); - - /** - * Run the customFunc function before the existingFunc function. - * - * @param existingFuncName The name of the existing function (existingFunc) - * you want to augment. - * - * @param customFunc The function to be invoked before existingFunc. - */ - before(method: string, fn: Function); - } - - export interface Component { - node: Element; - $node: JQuery; - } - - export interface Base extends Advice, Component { + export interface Base { /** * Most Components and Mixins need to define attributes. In Flight, @@ -181,6 +137,51 @@ declare module Flight { teardown(); } + export interface Advice extends Base { + /** + * Run the customFunc function after the existingFunc function. + * + * @param existingFuncName The name of the existing function (existingFunc) + * you want to augment. + * + * customFunc The function to be invoked after existingFunc. + */ + after(method: string, fn: Function); + + /** + * Run the existingFunc function in the middle of the customFunc function. + * It's similar to underscore's _wrap function). + * + * @param existingFuncName The name of the existing function (existingFunc) + * you want to augment. + * + * customFunc The function to wrap around existingFunc. The existingFunc + * function will be passed to customFunc as an argument. + * + * The existing function is passed to the custom function as an argument so + * that it can be referenced. If the custom function does not call the + * existing function then it will replace that function instead of + * surrounding it. + */ + around(method: string, fn: Function); + + /** + * Run the customFunc function before the existingFunc function. + * + * @param existingFuncName The name of the existing function (existingFunc) + * you want to augment. + * + * @param customFunc The function to be invoked before existingFunc. + */ + before(method: string, fn: Function); + } + + export interface Component extends Base, Advice { + node: Element; + $node: JQuery; + } + + export interface AdviceStatic { withAdvice(); } @@ -198,6 +199,15 @@ declare module Flight { unlockProperty(obj, prop, op); } + export interface DebugStatic { + events: { + logAll(); + logByAction(action: string); + logByName(name: string); + logNone(); + } + } + export interface LoggerStatic { } @@ -249,4 +259,5 @@ declare module Flight { } } +declare var DEBUG: Flight.DebugStatic; declare var flight: Flight.FlightStatic; \ No newline at end of file