Merge pull request #4565 from TrevorDev/master

added rivets definition and test
This commit is contained in:
Masahiro Wakame
2015-06-08 01:37:14 +09:00
2 changed files with 53 additions and 0 deletions

18
rivets/rivets-tests.ts Normal file
View File

@@ -0,0 +1,18 @@
/// <reference path="rivets.d.ts" />
Rivets.configure({
// Attribute prefix in templates
prefix: 'rv',
// Preload templates with initial data on bind
preloadData: true,
// Root sightglass interface for keypaths
rootInterface: '.',
// Template delimiters for text bindings
templateDelimiters: ['[[', ']]'],
// Augment the event handler of the on-* binder
handler: function(target:any, event:any, binding:any) {
this.call(target, event, binding.view.models)
}
})
var t = {test: ["hello", "one", "two"]}
Rivets.bind(document.getElementById("para1"), t)

35
rivets/rivets.d.ts vendored Normal file
View File

@@ -0,0 +1,35 @@
// Type definitions for rivets
// Project: http://rivetsjs.com/
// Definitions by: Trevor Baron <https://github.com/TrevorDev>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
interface FinchStatic {
configure(options?: {
/**
* Attribute prefix in templates
*/
prefix?: string;
/**
* Preload templates with initial data on bind
*/
preloadData?: boolean;
/**
* Root sightglass interface for keypaths
*/
rootInterface?: string;
/**
* Template delimiters for text bindings
*/
templateDelimiters?: Array<string>
/**
* Augment the event handler of the on-* binder
*/
handler?: Function;
}):void;
bind(element:any, template:any):void;
}
declare var Rivets: FinchStatic;
declare module "rivets" {
export = Rivets;
}