mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-04-01 12:42:58 +08:00
Merge pull request #4565 from TrevorDev/master
added rivets definition and test
This commit is contained in:
18
rivets/rivets-tests.ts
Normal file
18
rivets/rivets-tests.ts
Normal 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
35
rivets/rivets.d.ts
vendored
Normal 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;
|
||||
}
|
||||
Reference in New Issue
Block a user