Merge pull request #2075 from omidkrad/handlebars-runtime

Added definitions for Handlebars Runtime
This commit is contained in:
Bart van der Schoor
2014-04-28 17:58:13 +02:00
+26 -3
View File
@@ -4,22 +4,45 @@
// Definitions: https://github.com/borisyankov/DefinitelyTyped
// Use either HandlebarsStatic or HandlebarsRuntimeStatic
declare var Handlebars: HandlebarsStatic;
//declare var Handlebars: HandlebarsRuntimeStatic;
interface HandlebarsStatic {
/**
* Implement this interface on your MVW/MVVM/MVC views such as Backbone.View
**/
interface HandlebarsTemplatable {
template: HandlebarsTemplateDelegate;
}
interface HandlebarsTemplateDelegate {
(context: any, options?: any): string;
}
interface HandlebarsCommon {
registerHelper(name: string, fn: Function, inverse?: boolean): void;
registerPartial(name: string, str: any): void;
K(): void;
createFrame(object: any): any;
Exception(message: string): void;
SafeString: typeof SafeString;
parse(input: string): boolean;
logger: Logger;
log(level: number, obj: any): void;
compile(input: any, options?: any): (context?: any, options?: any) => string;
Logger: typeof Logger;
}
interface HandlebarsStatic extends HandlebarsCommon {
parse(input: string): boolean;
compile(input: any, options?: any): HandlebarsTemplateDelegate;
}
interface HandlebarsRuntimeStatic extends HandlebarsCommon {
// Handlebars.templates is the default template namespace in precompiler.
templates: { (s: string): HandlebarsTemplateDelegate }[];
}
declare class SafeString {
constructor(str: string);
static toString(): string;