Wrapped interfaces in module. Updated tests.

This commit is contained in:
Jonathan Hedrén
2013-10-28 12:58:18 +01:00
parent 385f229aa9
commit 364abd4f0f
2 changed files with 36 additions and 2 deletions

View File

@@ -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');
};

33
flight/flight.d.ts vendored
View File

@@ -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);
}