Add definition for "FileSaver.js"

This commit is contained in:
Cyril Schumacher
2015-01-16 14:25:53 +01:00
parent e3f1f8e491
commit 0a484fcb02
3 changed files with 39 additions and 0 deletions
+11
View File
@@ -0,0 +1,11 @@
/// <reference path="fileSaver.d.ts" />
/**
* @summary Test for "saveAs" function.
*/
function testSaveAs() {
var data: Blob = new Blob(["Hello, world!"], {type: "text/plain;charset=utf-8"});
var filename: string = 'hello world.txt';
saveAs(data, filename);
}
+1
View File
@@ -0,0 +1 @@
--noImplicitAny
+27
View File
@@ -0,0 +1,27 @@
// Type definitions for FileSaver.js
// Project: https://github.com/eligrey/FileSaver.js/
// Definitions by: Cyril Schumacher <https://github.com/cyrilschumacher>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
/**
* @summary Interface for "saveAs" function.
* @author Cyril Schumacher
* @version 1.0
*/
interface FileSaver {
(
/**
* @summary Data.
* @type {Blob}
*/
data: Blob,
/**
* @summary File name.
* @type {DOMString}
*/
filename: string
): void
}
declare var saveAs: FileSaver;