diff --git a/flight/flight-tests.ts b/flight/flight-tests.ts index 7b48eb93f8..69daaaad2b 100644 --- a/flight/flight-tests.ts +++ b/flight/flight-tests.ts @@ -4,13 +4,14 @@ declare var els: Element[]; declare var mixinFn: Function; function TestComponent() { - var self: FlightBase = this; + var self: Flight.Base = this; self.defaultAttrs({ fooSelector: '.bar' }); - this.onClick = function (ev: JQueryEventObject, data) { + this.onClick = function (ev: JQueryEventObject, data: Flight.EventData) { + var el: HTMLElement = data.el; self.select('fooSelector').addClass('bar'); }; diff --git a/flight/flight.d.ts b/flight/flight.d.ts index 1fa49113f0..25a005b4e1 100644 --- a/flight/flight.d.ts +++ b/flight/flight.d.ts @@ -7,8 +7,41 @@ interface FlightAdvice { + /** + * 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); }