Merge pull request #8346 from AbraaoAlves/jquery-truncate-html

Added jquery-truncate-html definitions
This commit is contained in:
Mohamed Hegazy
2016-06-22 16:45:45 -07:00
committed by GitHub
2 changed files with 36 additions and 0 deletions
@@ -0,0 +1,14 @@
/// <reference path="./jquery-truncate-html.d.ts" />
function truncateHtmlString(): string {
return $.truncate('<p>Stuff and <i>Nonsense</i></p>', {
length: 13
});
}
function truncateVirtualElement (): JQuery {
return $('<p>Stuff and <i>Nonsense</i></p>').truncate({
length: 13
});
}
+22
View File
@@ -0,0 +1,22 @@
// Type definitions for jQuery-truncate-html.js
// Project: https://github.com/kbwood/timeentry
// Definitions by: Abraão Alves <https://github.com/abraaoalves>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
/// <reference path="../jquery/jquery.d.ts"/>
interface TruncateOptions{
length?: number;
stripTags?: boolean;
words?: boolean;
noBreaks?: boolean;
ellipsis?: string;
}
interface JQuery{
truncate(options: TruncateOptions) : JQuery;
}
interface JQueryStatic {
truncate(html: string, options: TruncateOptions) : string;
}