mirror of
https://github.com/wassname/DefinitelyTyped.git
synced 2026-09-09 11:13:57 +08:00
Merge remote-tracking branch 'upstream/master'
This commit is contained in:
@@ -69,6 +69,7 @@ List of Definitions
|
||||
* [Firebase](https://www.firebase.com/docs/javascript/firebase) (by [Vincent Bortone](https://github.com/vbortone))
|
||||
* [Firefox](https://developer.mozilla.org/en-US/docs/Web/API) (by [vvakame](https://github.com/vvakame))
|
||||
* [FlexSlider](http://www.woothemes.com/flexslider/) (by [Diullei Gomes](https://github.com/Diullei))
|
||||
* [Flight by Twitter](http://flightjs.github.com/flight/) (by [Jonathan Hedrén](https://github.com/jonathanhedren))
|
||||
* [Foundation](http://foundation.zurb.com/) (by [Boris Yankov](https://github.com/borisyankov))
|
||||
* [FPSMeter](http://darsa.in/fpsmeter/) (by [Aaron Lampros](https://github.com/alampros))
|
||||
* [FullCalendar](http://arshaw.com/fullcalendar/) (by [Neil Stalker](https://github.com/nestalk))
|
||||
@@ -95,7 +96,6 @@ List of Definitions
|
||||
* [i18next](http://i18next.com/) (by [Maarten Docter](https://github.com/mdocter))
|
||||
* [iCheck](http://damirfoy.com/iCheck/) (by [Dániel Tar](https://github.com/qcz))
|
||||
* [Impress.js](https://github.com/bartaz/impress.js) (by [Boris Yankov](https://github.com/borisyankov))
|
||||
* [Intl](http://www.ecma-international.org/ecma-402/1.0/) (by [Jeffery Grajkowski](http://github.com/pushplay))
|
||||
* [iScroll](http://cubiq.org/iscroll-4) (by [Boris Yankov](https://github.com/borisyankov) and [Christiaan Rakowski](https://github.com/csrakowski))
|
||||
* [jake](https://github.com/mde/jake) (by [Kon](http://phyzkit.net/))
|
||||
* [Jasmine](http://pivotal.github.com/jasmine/) (by [Boris Yankov](https://github.com/borisyankov))
|
||||
@@ -109,9 +109,10 @@ List of Definitions
|
||||
* [jQuery.areYouSure](https://github.com/codedance/jquery.AreYouSure) (by [Jon Egerton](https://github.com/jonegerton))
|
||||
* [jQuery.autosize](http://www.jacklmoore.com/autosize/) (by [Jack Moore](http://www.jacklmoore.com/))
|
||||
* [jQuery.BBQ](http://benalman.com/projects/jquery-bbq-plugin/) (by [Adam R. Smith](https://github.com/sunetos))
|
||||
* [jQuery.contextMenu](http://medialize.github.com/jQuery-contextMenu/) (by [Natan Vivo](https://github.com/nvivo/))
|
||||
* [jQuery.CLEditor](http://premiumsoftware.net/CLEditor) (by [Jeffery Grajkowski](https://github.com/pushplay))
|
||||
* [jQuery.clientSideLogging](https://github.com/remybach/jQuery.clientSideLogging/) (by [Diullei Gomes](https://github.com/diullei/))
|
||||
* [jQuery.Colorbox](http://www.jacklmoore.com/colorbox/) (by [Gidon Junge](https://github.com/gjunge))
|
||||
* [jQuery.contextMenu](http://medialize.github.com/jQuery-contextMenu/) (by [Natan Vivo](https://github.com/nvivo/))
|
||||
* [jQuery.Cookie](https://github.com/carhartl/jquery-cookie) (by [Roy Goode](https://github.com/RoyGoode))
|
||||
* [jQuery.Cycle](http://jquery.malsup.com/cycle/) (by [François Guillot](http://fguillot.developpez.com/))
|
||||
* [jQuery.dataTables](http://www.datatables.net) (by [Armin Sander](https://github.com/pragmatrix))
|
||||
@@ -135,6 +136,7 @@ List of Definitions
|
||||
* [jQuery.Transit](http://ricostacruz.com/jquery.transit/) (by [MrBigDog2U](https://github.com/MrBigDog2U))
|
||||
* [jQuery.Validation](http://bassistance.de/jquery-plugins/jquery-plugin-validation/) (by [Boris Yankov](https://github.com/borisyankov))
|
||||
* [jQuery.Watermark](http://jquery-watermark.googlecode.com) (by [Anwar Javed](https://github.com/anwarjaved))
|
||||
* [jQuery.base64](https://github.com/yatt/jquery.base64) (by [Shinya Mochizuki](https://github.com/enrapt-mochizuki))
|
||||
* [jScrollPane](http://jscrollpane.kelvinluck.com) (by [Dániel Tar](https://github.com/qcz))
|
||||
* [JSDeferred](http://cho45.stfuawsc.com/jsdeferred/) (by [Daisuke Mino](https://github.com/minodisk))
|
||||
* [JSONEditorOnline](https://github.com/josdejong/jsoneditoronline) (by [Vincent Bortone](https://github.com/vbortone/))
|
||||
@@ -147,7 +149,7 @@ List of Definitions
|
||||
* [Knockout.ES5](https://github.com/SteveSanderson/knockout-es5) (by [Sebastián Galiano](https://github.com/sgaliano))
|
||||
* [Knockout.Mapper](https://github.com/LucasLorentz/knockout.mapper) (by [Brandon Meyer](https://github.com/BMeyerKC))
|
||||
* [Knockout.Mapping](https://github.com/SteveSanderson/knockout.mapping) (by [Boris Yankov](https://github.com/borisyankov))
|
||||
* [Knockout.Postbox](https://github.com/rniemeyer/knockout-postbox) (by [Judah Gabriel](https://github.com/JudahGabriel))
|
||||
* [Knockout.Postbox](https://github.com/rniemeyer/knockout-postbox) (by [Judah Gabriel Himango](https://github.com/JudahGabriel))
|
||||
* [Knockout.Validation](https://github.com/ericmbarnard/Knockout-Validation) (by [Dan Ludwig](https://github.com/danludwig))
|
||||
* [Knockout.Viewmodel](http://coderenaissance.github.com/knockout.viewmodel/) (by [Oisin Grehan](https://github.com/oising))
|
||||
* [ko.editables](http://romanych.github.com/ko.editables/) (by [Oisin Grehan](https://github.com/oising))
|
||||
@@ -158,6 +160,7 @@ List of Definitions
|
||||
* [Levelup](https://github.com/rvagg/node-levelup) (by [Bret Little](https://github.com/blittle))
|
||||
* [linq.js](http://linqjs.codeplex.com/) (by [Marcin Najder](https://github.com/marcinnajder))
|
||||
* [Livestamp.js](https://github.com/mattbradley/livestampjs) (by [Vincent Bortone](https://github.com/vbortone))
|
||||
* [Lodash](http://lodash.com/) (by [Brian Zengel](https://github.com/bczengel))
|
||||
* [Logg](https://github.com/dpup/node-logg) (by [Bret Little](https://github.com/blittle))
|
||||
* [Marked](https://github.com/chjj/marked) (by [William Orr](https://github.com/worr))
|
||||
* [mCustomScrollbar](https://github.com/malihu/malihu-custom-scrollbar-plugin) (by [Sarah Williams] (https://github.com/flurg))
|
||||
@@ -172,7 +175,9 @@ List of Definitions
|
||||
* [node-ffi](https://github.com/rbranson/node-ffi) (by [Paul Loyd](https://github.com/loyd))
|
||||
* [node_zeromq](https://github.com/JustinTulloss/zeromq.node) (by [Dave McKeown](https://github.com/davemckeown))
|
||||
* [node-sqlserver](https://github.com/WindowsAzure/node-sqlserver) (by [Boris Yankov](https://github.com/borisyankov))
|
||||
* [NProgress](https://github.com/rstacruz/nprogress) (by [Judah Gabriel Himango](https://github.com/judahgabriel))
|
||||
* [Numeral.js](https://github.com/adamwdraper/Numeral-js) (by [Vincent Bortone](https://github.com/vbortone/))
|
||||
* [OpenLayers] (https://github.com/openlayers/openlayers) (by [Ilya Bolkhovsky](https://github.com/bolhovsky/))
|
||||
* [Parallel.js](https://github.com/adambom/parallel.js) (by [Josh Baldwin](https://github.com/jbaldwin))
|
||||
* [PDF.js](https://github.com/mozilla/pdf.js) (by [Josh Baldwin](https://github.com/jbaldwin))
|
||||
* [Persona](http://www.mozilla.org/en-US/persona) (by [James Frasca](https://github.com/Nycto))
|
||||
@@ -239,7 +244,6 @@ Requested Definitions
|
||||
* [google.visualizations](https://developers.google.com/chart/)
|
||||
* [Prelude.ls](http://gkz.github.com/prelude-ls/)
|
||||
* [MooTools](http://mootools.net/)
|
||||
* [Lo-Dash](http://lodash.com/)
|
||||
* [java](https://github.com/nearinfinity/node-java)
|
||||
* [SVG.js](http://www.svgjs.com/)
|
||||
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
tsc runner.ts --out runner.js --module commonjs
|
||||
+106
-46
@@ -552,10 +552,11 @@ else if (typeof require === "function")
|
||||
else
|
||||
return null;
|
||||
})();
|
||||
/// <reference path='src/exec.ts' />
|
||||
/// <reference path='src/io.ts' />
|
||||
var DefinitelyTyped;
|
||||
(function (DefinitelyTyped) {
|
||||
/// <reference path='../../node/node.d.ts' />
|
||||
/// <reference path='src/exec.ts' />
|
||||
/// <reference path='src/io.ts' />
|
||||
(function (TestManager) {
|
||||
var path = require('path');
|
||||
|
||||
@@ -614,6 +615,10 @@ var DefinitelyTyped;
|
||||
return Typing;
|
||||
})();
|
||||
|
||||
/////////////////////////////////
|
||||
// Given a document root + ts file pattern this class returns:
|
||||
// all the TS files OR just tests OR just definition files
|
||||
/////////////////////////////////
|
||||
var FileHandler = (function () {
|
||||
function FileHandler(path, pattern) {
|
||||
this.path = path;
|
||||
@@ -659,6 +664,10 @@ var DefinitelyTyped;
|
||||
return FileHandler;
|
||||
})();
|
||||
|
||||
/////////////////////////////////
|
||||
// Timer.start starts a timer
|
||||
// Timer.end stops the timer and sets asString to the pretty print value
|
||||
/////////////////////////////////
|
||||
var Timer = (function () {
|
||||
function Timer() {
|
||||
this.time = 0;
|
||||
@@ -688,6 +697,9 @@ var DefinitelyTyped;
|
||||
return Timer;
|
||||
})();
|
||||
|
||||
/////////////////////////////////
|
||||
// All the common things that we pring are functions of this class
|
||||
/////////////////////////////////
|
||||
var Print = (function () {
|
||||
function Print(version, typings, tsFiles) {
|
||||
this.version = version;
|
||||
@@ -707,19 +719,19 @@ var DefinitelyTyped;
|
||||
this.out(' \33[36m\33[1mTypeScript files :\33[0m ' + this.tsFiles + '\n');
|
||||
};
|
||||
|
||||
Print.prototype.printSyntaxChecking = function () {
|
||||
Print.prototype.printSyntaxCheckingHeader = function () {
|
||||
this.out('============================ \33[34m\33[1mSyntax checking\33[0m ================================\n');
|
||||
};
|
||||
|
||||
Print.prototype.printTypingTests = function () {
|
||||
Print.prototype.printTypingTestsHeader = function () {
|
||||
this.out('============================= \33[34m\33[1mTyping tests\33[0m ==================================\n');
|
||||
};
|
||||
|
||||
Print.prototype.printSuccess = function () {
|
||||
Print.prototype.printSuccessCharacter = function () {
|
||||
this.out('\33[36m\33[1m.\33[0m');
|
||||
};
|
||||
|
||||
Print.prototype.printFailure = function () {
|
||||
Print.prototype.printFailureCharacter = function () {
|
||||
this.out('x');
|
||||
};
|
||||
|
||||
@@ -727,6 +739,23 @@ var DefinitelyTyped;
|
||||
this.out('-----------------------------------------------------------------------------\n');
|
||||
};
|
||||
|
||||
Print.prototype.printBoldDiv = function () {
|
||||
this.out('=============================================================================\n');
|
||||
};
|
||||
|
||||
Print.prototype.printErrorsHeader = function () {
|
||||
this.out('=============================================================================\n');
|
||||
this.out(' \33[34m\33[1mErrors in files\33[0m \n');
|
||||
this.out('=============================================================================\n');
|
||||
};
|
||||
|
||||
Print.prototype.printErrorsForFile = function (file) {
|
||||
this.out('----------------- For file:' + file.formatName());
|
||||
this.printBreak();
|
||||
this.out(file.execResult.stderr);
|
||||
this.printBreak();
|
||||
};
|
||||
|
||||
Print.prototype.printfilesWithSintaxErrorMessage = function () {
|
||||
this.out(' \33[36m\33[1mFiles with syntax error\33[0m\n');
|
||||
};
|
||||
@@ -751,7 +780,7 @@ var DefinitelyTyped;
|
||||
this.out(' - \33[33m\33[1m' + file + '\33[0m\n');
|
||||
};
|
||||
|
||||
Print.prototype.breack = function () {
|
||||
Print.prototype.printBreak = function () {
|
||||
this.out('\n');
|
||||
};
|
||||
|
||||
@@ -781,22 +810,30 @@ var DefinitelyTyped;
|
||||
return Print;
|
||||
})();
|
||||
|
||||
/////////////////////////////
|
||||
// Represents the results of a test file execution
|
||||
/////////////////////////////
|
||||
var File = (function () {
|
||||
function File(name, hasError) {
|
||||
this.name = name;
|
||||
this.hasError = hasError;
|
||||
function File(baseDir, filePathWithName, execResult) {
|
||||
this.baseDir = baseDir;
|
||||
this.filePathWithName = filePathWithName;
|
||||
this.execResult = execResult;
|
||||
}
|
||||
File.prototype.formatName = function (baseDir) {
|
||||
var dirName = path.dirname(this.name.substr(baseDir.length + 1)).replace('\\', '/');
|
||||
// From '/complete/path/to/file' to 'specfolder/specfile.d.ts'
|
||||
File.prototype.formatName = function () {
|
||||
var dirName = path.dirname(this.filePathWithName.substr(this.baseDir.length + 1)).replace('\\', '/');
|
||||
var dir = dirName.split('/')[0];
|
||||
var file = path.basename(this.name, '.ts');
|
||||
var ext = path.extname(this.name);
|
||||
var file = path.basename(this.filePathWithName, '.ts');
|
||||
var ext = path.extname(this.filePathWithName);
|
||||
|
||||
return dir + ((dirName.split('/').length > 1) ? '/-/' : '/') + '\33[36m\33[1m' + file + '\33[0m' + ext;
|
||||
};
|
||||
return File;
|
||||
})();
|
||||
|
||||
/////////////////////////////
|
||||
// Determine syntax errors in typings
|
||||
/////////////////////////////
|
||||
var SyntaxChecking = (function () {
|
||||
function SyntaxChecking(fileHandler, out) {
|
||||
this.fileHandler = fileHandler;
|
||||
@@ -808,7 +845,7 @@ var DefinitelyTyped;
|
||||
var list = [];
|
||||
|
||||
for (var i = 0; i < this.files.length; i++) {
|
||||
if (this.files[i].hasError) {
|
||||
if (this.files[i].execResult.exitCode) {
|
||||
list.push(this.files[i]);
|
||||
}
|
||||
}
|
||||
@@ -820,7 +857,7 @@ var DefinitelyTyped;
|
||||
var list = [];
|
||||
|
||||
for (var i = 0; i < this.files.length; i++) {
|
||||
if (!this.files[i].hasError) {
|
||||
if (!this.files[i].execResult.exitCode) {
|
||||
list.push(this.files[i]);
|
||||
}
|
||||
}
|
||||
@@ -845,7 +882,7 @@ var DefinitelyTyped;
|
||||
|
||||
for (var i = 0; i < this.getFailedFiles().length; i++) {
|
||||
var errorFile = this.getFailedFiles()[i];
|
||||
this.out.printErrorFile(errorFile.formatName(this.fileHandler.path));
|
||||
this.out.printErrorFile(errorFile.formatName());
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -853,29 +890,26 @@ var DefinitelyTyped;
|
||||
SyntaxChecking.prototype.run = function (it, file, len, maxLen, callback) {
|
||||
var _this = this;
|
||||
if (!endsWith(file.toUpperCase(), '-TESTS.TS') && endsWith(file.toUpperCase(), '.TS') && file.indexOf('../_infrastructure') < 0) {
|
||||
new Test(file).run(function (o) {
|
||||
var failed = false;
|
||||
|
||||
if (o.exitCode === 1) {
|
||||
_this.out.printFailure();
|
||||
failed = true;
|
||||
new Test(file).run(function (execResult) {
|
||||
if (execResult.exitCode === 1) {
|
||||
_this.out.printFailureCharacter();
|
||||
len++;
|
||||
} else {
|
||||
_this.out.printSuccess();
|
||||
_this.out.printSuccessCharacter();
|
||||
len++;
|
||||
}
|
||||
|
||||
_this.files.push(new File(file, failed));
|
||||
_this.files.push(new File(_this.fileHandler.path, file, execResult));
|
||||
|
||||
if (len > maxLen) {
|
||||
len = 0;
|
||||
_this.out.breack();
|
||||
_this.out.printBreak();
|
||||
}
|
||||
|
||||
if (it.hasNext()) {
|
||||
_this.run(it, it.next(), len, maxLen, callback);
|
||||
} else {
|
||||
_this.out.breack();
|
||||
_this.out.printBreak();
|
||||
_this.timer.end();
|
||||
_this.printFailedFiles();
|
||||
_this.printStats();
|
||||
@@ -886,7 +920,7 @@ var DefinitelyTyped;
|
||||
} else if (it.hasNext()) {
|
||||
this.run(it, it.next(), len, maxLen, callback);
|
||||
} else {
|
||||
this.out.breack();
|
||||
this.out.printBreak();
|
||||
this.timer.end();
|
||||
this.printStats();
|
||||
this.printFailedFiles();
|
||||
@@ -912,6 +946,9 @@ var DefinitelyTyped;
|
||||
return SyntaxChecking;
|
||||
})();
|
||||
|
||||
/////////////////////////////
|
||||
// Determines errors in typing tests
|
||||
/////////////////////////////
|
||||
var TestEval = (function () {
|
||||
function TestEval(fileHandler, out) {
|
||||
this.fileHandler = fileHandler;
|
||||
@@ -923,7 +960,7 @@ var DefinitelyTyped;
|
||||
var list = [];
|
||||
|
||||
for (var i = 0; i < this.files.length; i++) {
|
||||
if (this.files[i].hasError) {
|
||||
if (this.files[i].execResult.exitCode) {
|
||||
list.push(this.files[i]);
|
||||
}
|
||||
}
|
||||
@@ -935,7 +972,7 @@ var DefinitelyTyped;
|
||||
var list = [];
|
||||
|
||||
for (var i = 0; i < this.files.length; i++) {
|
||||
if (!this.files[i].hasError) {
|
||||
if (!this.files[i].execResult.exitCode) {
|
||||
list.push(this.files[i]);
|
||||
}
|
||||
}
|
||||
@@ -960,7 +997,7 @@ var DefinitelyTyped;
|
||||
|
||||
for (var i = 0; i < this.getFailedFiles().length; i++) {
|
||||
var errorFile = this.getFailedFiles()[i];
|
||||
this.out.printErrorFile(errorFile.formatName(this.fileHandler.path));
|
||||
this.out.printErrorFile(errorFile.formatName());
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -968,29 +1005,26 @@ var DefinitelyTyped;
|
||||
TestEval.prototype.run = function (it, file, len, maxLen, callback) {
|
||||
var _this = this;
|
||||
if (endsWith(file.toUpperCase(), '-TESTS.TS')) {
|
||||
new Test(file).run(function (o) {
|
||||
var failed = false;
|
||||
|
||||
if (o.exitCode === 1) {
|
||||
_this.out.printFailure();
|
||||
failed = true;
|
||||
new Test(file).run(function (execResult) {
|
||||
if (execResult.exitCode === 1) {
|
||||
_this.out.printFailureCharacter();
|
||||
len++;
|
||||
} else {
|
||||
_this.out.printSuccess();
|
||||
_this.out.printSuccessCharacter();
|
||||
len++;
|
||||
}
|
||||
|
||||
_this.files.push(new File(file, failed));
|
||||
_this.files.push(new File(_this.fileHandler.path, file, execResult));
|
||||
|
||||
if (len > maxLen) {
|
||||
len = 0;
|
||||
_this.out.breack();
|
||||
_this.out.printBreak();
|
||||
}
|
||||
|
||||
if (it.hasNext()) {
|
||||
_this.run(it, it.next(), len, maxLen, callback);
|
||||
} else {
|
||||
_this.out.breack();
|
||||
_this.out.printBreak();
|
||||
_this.timer.end();
|
||||
_this.printFailedFiles();
|
||||
_this.printStats();
|
||||
@@ -1001,7 +1035,7 @@ var DefinitelyTyped;
|
||||
} else if (it.hasNext()) {
|
||||
this.run(it, it.next(), len, maxLen, callback);
|
||||
} else {
|
||||
this.out.breack();
|
||||
this.out.printBreak();
|
||||
this.timer.end();
|
||||
this.printFailedFiles();
|
||||
this.printStats();
|
||||
@@ -1027,6 +1061,9 @@ var DefinitelyTyped;
|
||||
return TestEval;
|
||||
})();
|
||||
|
||||
/////////////////////////////////
|
||||
// The main class to kick things off
|
||||
/////////////////////////////////
|
||||
var TestRunner = (function () {
|
||||
function TestRunner(dtPath) {
|
||||
this.dtPath = dtPath;
|
||||
@@ -1065,19 +1102,41 @@ var DefinitelyTyped;
|
||||
return count;
|
||||
};
|
||||
|
||||
TestRunner.prototype.printErrorsDetected = function () {
|
||||
var _this = this;
|
||||
this.out.printErrorsHeader();
|
||||
|
||||
var printErrorsForFileIfFound = function (file) {
|
||||
if (file.execResult.exitCode)
|
||||
_this.out.printErrorsForFile(file);
|
||||
};
|
||||
|
||||
// sc errors:
|
||||
this.sc.files.forEach(printErrorsForFileIfFound);
|
||||
this.out.printBoldDiv();
|
||||
|
||||
// te errors:
|
||||
this.te.files.forEach(printErrorsForFileIfFound);
|
||||
this.out.printBoldDiv();
|
||||
};
|
||||
|
||||
TestRunner.prototype.run = function () {
|
||||
var _this = this;
|
||||
var timer = new Timer();
|
||||
timer.start();
|
||||
|
||||
this.out.printHeader();
|
||||
this.out.printSyntaxChecking();
|
||||
|
||||
// Run syntax tests
|
||||
this.out.printSyntaxCheckingHeader();
|
||||
this.sc.start(function (syntaxFailedCount, syntaxTotal) {
|
||||
_this.out.printTypingTests();
|
||||
// Now run typing tests
|
||||
_this.out.printTypingTestsHeader();
|
||||
_this.te.start(function (testFailedCount, testTotal) {
|
||||
var total = _this.printTypingsWithoutTest();
|
||||
// Get the tests without any typing and simultaneously print their names
|
||||
var totalTypingsWithoutTest = _this.printTypingsWithoutTest();
|
||||
|
||||
// End total timer and print final messages
|
||||
timer.end();
|
||||
|
||||
_this.out.printDiv();
|
||||
@@ -1087,11 +1146,12 @@ var DefinitelyTyped;
|
||||
_this.out.printElapsedTime(timer.asString, timer.time);
|
||||
_this.out.printSyntaxErrorCount(syntaxFailedCount, syntaxTotal);
|
||||
_this.out.printTestErrorCount(testFailedCount, testTotal);
|
||||
_this.out.printWithoutTestCount(total, _this.fh.allTypings().length);
|
||||
_this.out.printWithoutTestCount(totalTypingsWithoutTest, _this.fh.allTypings().length);
|
||||
|
||||
_this.out.printDiv();
|
||||
|
||||
if (syntaxFailedCount > 0 || testFailedCount > 0) {
|
||||
_this.printErrorsDetected();
|
||||
process.exit(1);
|
||||
}
|
||||
});
|
||||
|
||||
+619
-555
File diff suppressed because it is too large
Load Diff
@@ -83,22 +83,12 @@ declare class Enumerator {
|
||||
public item(): any;
|
||||
constructor (o: any);
|
||||
}
|
||||
declare function setTimeout(callback: () =>void , ms?: number);
|
||||
//declare var require: any;
|
||||
declare module process {
|
||||
export var argv: string[];
|
||||
export var platform: string;
|
||||
export function on(event: string, handler: (any) => void ): void;
|
||||
export module stdout {
|
||||
export function write(str: string);
|
||||
|
||||
// Missing in node definitions, but called in code below.
|
||||
interface NodeProcess {
|
||||
mainModule: {
|
||||
filename: string;
|
||||
}
|
||||
export module stderr {
|
||||
export function write(str: string);
|
||||
}
|
||||
export module mainModule {
|
||||
export var filename: string;
|
||||
}
|
||||
export function exit(exitCode?: number);
|
||||
}
|
||||
|
||||
var IO = (function() {
|
||||
|
||||
Vendored
+65
-3
@@ -94,7 +94,7 @@ declare module ng {
|
||||
controller(name: string, controllerConstructor: Function): IModule;
|
||||
controller(name: string, inlineAnnotadedConstructor: any[]): IModule;
|
||||
controller(object : Object): IModule;
|
||||
directive(name: string, directiveFactory: (...params:any[])=> IDirective): IModule;
|
||||
directive(name: string, directiveFactory: Function): IModule;
|
||||
directive(name: string, inlineAnnotadedFunction: any[]): IModule;
|
||||
directive(object: Object): IModule;
|
||||
factory(name: string, serviceFactoryFunction: Function): IModule;
|
||||
@@ -215,8 +215,8 @@ declare module ng {
|
||||
$emit(name: string, ...args: any[]): IAngularEvent;
|
||||
|
||||
// Documentation says exp is optional, but actual implementaton counts on it
|
||||
$eval(expression: string): any;
|
||||
$eval(expression: (scope: IScope) => any): any;
|
||||
$eval(expression: string, args?: Object): any;
|
||||
$eval(expression: (scope: IScope) => any, args?: Object): any;
|
||||
|
||||
// Documentation says exp is optional, but actual implementaton counts on it
|
||||
$evalAsync(expression: string): void;
|
||||
@@ -276,6 +276,15 @@ declare module ng {
|
||||
cancel(promise: IPromise<any>): boolean;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// IntervalService
|
||||
// see http://docs.angularjs.org/api/ng.$interval
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
interface IIntervalService {
|
||||
(func: Function, delay: number, count?: number, invokeApply?: boolean): IPromise<any>;
|
||||
cancel(promise: IPromise<any>): boolean;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// FilterService
|
||||
// see http://docs.angularjs.org/api/ng.$filter
|
||||
@@ -640,6 +649,59 @@ declare module ng {
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
interface IRootScopeService extends IScope {}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// SCEService
|
||||
// see http://docs.angularjs.org/api/ng.$sce
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
interface ISCEService {
|
||||
getTrusted(type: string, mayBeTrusted: any): any;
|
||||
getTrustedCss(value: any): any;
|
||||
getTrustedHtml(value: any): any;
|
||||
getTrustedJs(value: any): any;
|
||||
getTrustedResourceUrl(value: any): any;
|
||||
getTrustedUrl(value: any): any;
|
||||
parse(type: string, expression: string): (context: any, locals: any) => any;
|
||||
parseAsCss(expression: string): (context: any, locals: any) => any;
|
||||
parseAsHtml(expression: string): (context: any, locals: any) => any;
|
||||
parseAsJs(expression: string): (context: any, locals: any) => any;
|
||||
parseAsResourceUrl(expression: string): (context: any, locals: any) => any;
|
||||
parseAsUrl(expression: string): (context: any, locals: any) => any;
|
||||
trustAs(type: string, value: any): any;
|
||||
trustAsHtml(value: any): any;
|
||||
trustAsJs(value: any): any;
|
||||
trustAsResourceUrl(value: any): any;
|
||||
trustAsUrl(value: any): any;
|
||||
isEnabled(): boolean;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// SCEProvider
|
||||
// see http://docs.angularjs.org/api/ng.$sceProvider
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
interface ISCEProvider extends IServiceProvider {
|
||||
enabled(value: boolean): void;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// SCEDelegateService
|
||||
// see http://docs.angularjs.org/api/ng.$sceDelegate
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
interface ISCEDelegateService {
|
||||
getTrusted(type: string, mayBeTrusted: any): any;
|
||||
trustAs(type: string, value: any): any;
|
||||
valueOf(value: any): any;
|
||||
}
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// SCEDelegateProvider
|
||||
// see http://docs.angularjs.org/api/ng.$sceDelegateProvider
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
interface ISCEDelegateProvider extends IServiceProvider {
|
||||
resourceUrlBlacklist(blacklist: any[]): void;
|
||||
resourceUrlWhitelist(whitelist: any[]): void;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// Directive
|
||||
// see http://docs.angularjs.org/api/ng.$compileProvider#directive
|
||||
|
||||
Vendored
+187
-167
@@ -5,39 +5,50 @@
|
||||
|
||||
/// <reference path="../phantomjs/phantomjs.d.ts" />
|
||||
|
||||
interface Casper {
|
||||
interface CasperModule {
|
||||
create(options: CasperOptions): Casper;
|
||||
selectXPath(expression: string): Object
|
||||
}
|
||||
|
||||
constructor (options: CasperOptions);
|
||||
interface EventEmitter {
|
||||
removeAllFilters(filter: string): Casper;
|
||||
setFilter(filter: string, cb: Function): boolean;
|
||||
}
|
||||
|
||||
interface Casper extends EventEmitter {
|
||||
test: Tester;
|
||||
|
||||
constructor (options: CasperOptions): Casper;
|
||||
|
||||
// Properties
|
||||
__utils__: ClientUtils;
|
||||
|
||||
// Methods
|
||||
back();
|
||||
base64encode(url: string, method?: string, data?: any);
|
||||
click(selector: string);
|
||||
clickLabel(label: string, tag?: string);
|
||||
capture(targetFilePath: string, clipRect: ClipRect);
|
||||
captureBase64(format: string);
|
||||
captureBase64(format: string, area: string);
|
||||
captureBase64(format: string, area: ClipRect);
|
||||
captureBase64(format: string, area: any);
|
||||
captureSelector(targetFile: string, selector: string);
|
||||
clear();
|
||||
debugHTML(selector?: string, outer?: boolean);
|
||||
debugPage();
|
||||
die(message: string, status?: number);
|
||||
download(url: string, target?: string, method?: string, data?: any);
|
||||
each(array: Array, fn: (self, link) => void);
|
||||
echo(message: string, style?: string);
|
||||
evaluate(fn: Function, ...args: any[]);
|
||||
evaluateOrDie(fn: Function, message?: string);
|
||||
exit(status?: number);
|
||||
exists(selector: string);
|
||||
fetchText(selector: string);
|
||||
forward();
|
||||
log(message: string, level?: string, space?: string);
|
||||
fill(selector: string, values: any, submit?: boolean);
|
||||
back(): Casper;
|
||||
base64encode(url: string, method?: string, data?: any): string;
|
||||
click(selector: string): boolean;
|
||||
clickLabel(label: string, tag?: string): boolean;
|
||||
capture(targetFilePath: string, clipRect: ClipRect): Casper;
|
||||
captureBase64(format: string): string;
|
||||
captureBase64(format: string, area: string): string;
|
||||
captureBase64(format: string, area: ClipRect): string;
|
||||
captureBase64(format: string, area: any): string;
|
||||
captureSelector(targetFile: string, selector: string): Casper;
|
||||
clear(): Casper;
|
||||
debugHTML(selector?: string, outer?: boolean): Casper;
|
||||
debugPage(): Casper;
|
||||
die(message: string, status?: number): Casper;
|
||||
download(url: string, target?: string, method?: string, data?: any): Casper;
|
||||
each<T>(array: T[], fn: (self: Casper, item: T, index: number) => void): Casper;
|
||||
echo(message: string, style?: string): Casper;
|
||||
evaluate<T>(fn: () => T, ...args: any[]): T
|
||||
evaluateOrDie(fn: () => any, message?: string, status?: number): Casper;
|
||||
exit(status?: number): Casper;
|
||||
exists(selector: string): boolean;
|
||||
fetchText(selector: string): string;
|
||||
forward(): Casper;
|
||||
log(message: string, level?: string, space?: string): Casper;
|
||||
fill(selector: string, values: any, submit?: boolean): void;
|
||||
getCurrentUrl(): string;
|
||||
getElementAttribute(selector: string, attribute: string): string;
|
||||
getElementBounds(selector: string): ElementBounds;
|
||||
@@ -48,44 +59,44 @@ interface Casper {
|
||||
getHTML(selector?: string, outer?: boolean): string;
|
||||
getPageContent(): string;
|
||||
getTitle(): string;
|
||||
mouseEvent(type: string, selector: string);
|
||||
mouseEvent(type: string, selector: string): boolean;
|
||||
open(location: string, settings: OpenSettings): Casper;
|
||||
reload(then?: (response: HttpResponse) => void);
|
||||
repeat(times: number, then: Function);
|
||||
resourceExists(test: Function);
|
||||
resourceExists(test: string);
|
||||
run(onComplete: Function, time?: number);
|
||||
sendKeys(selector: string, keys: string, options?: any);
|
||||
setHttpAuth(username: string, password: string);
|
||||
reload(then?: (response: HttpResponse) => void): Casper;
|
||||
repeat(times: number, then: Function): Casper;
|
||||
resourceExists(test: Function): boolean;
|
||||
resourceExists(test: string): boolean;
|
||||
run(onComplete: Function, time?: number): Casper;
|
||||
sendKeys(selector: string, keys: string, options?: any): Casper;
|
||||
setHttpAuth(username: string, password: string): Casper;
|
||||
start(url?: string, then?: (response: HttpResponse) => void): Casper;
|
||||
status(asString: boolean): any;
|
||||
then(fn: (self?: Casper) => void);
|
||||
thenClick(selector: string);
|
||||
thenEvaluate(fn: Function, ...args: any[]);
|
||||
thenOpen(location: string, then?: (response: HttpResponse) => void);
|
||||
thenOpen(location: string, options?: OpenSettings, then?: (response: HttpResponse) => void);
|
||||
thenOpenAndEvaluate(location: string, then?: Function, ...args: any[]);
|
||||
toString();
|
||||
userAgent(agent: string);
|
||||
viewport(width: number, height: number);
|
||||
visible(selector: string);
|
||||
wait(timeout: number, then?: Function);
|
||||
waitFor(testFx: Function, then?: Function, onTimeout?: Function, timeout?: number);
|
||||
waitForPopup(urlPattern: string, then?: Function, onTimeout?: Function, timeout?: number);
|
||||
waitForPopup(urlPattern: RegExp, then?: Function, onTimeout?: Function, timeout?: number);
|
||||
waitForSelector(selector: string, then?: Function, onTimeout?: Function, timeout?: number);
|
||||
waitWhileSelector(selector: string, then?: Function, onTimeout?: Function, timeout?: number);
|
||||
waitForResource(testFx: Function, then?: Function, onTimeout?: Function, timeout?: number);
|
||||
waitForText(pattern: string, then?: Function, onTimeout?: Function, timeout?: number);
|
||||
waitForText(pattern: RegExp, then?: Function, onTimeout?: Function, timeout?: number);
|
||||
waitUntilVisible(selector: string, then?: Function, onTimeout?: Function, timeout?: number);
|
||||
waitWhileVisible(selector: string, then?: Function, onTimeout?: Function, timeout?: number);
|
||||
warn(message: string);
|
||||
withFrame(frameInfo: string, then: Function);
|
||||
withFrame(frameInfo: number, then: Function);
|
||||
withPopup(popupInfo: string, step: Function);
|
||||
withPopup(popupInfo: RegExp, step: Function);
|
||||
zoom(factor: number);
|
||||
then(fn: (self?: Casper) => void): Casper;
|
||||
thenClick(selector: string): Casper;
|
||||
thenEvaluate(fn: () => any, ...args: any[]): Casper;
|
||||
thenOpen(location: string, then?: (response: HttpResponse) => void): Casper;
|
||||
thenOpen(location: string, options?: OpenSettings, then?: (response: HttpResponse) => void): Casper;
|
||||
thenOpenAndEvaluate(location: string, then?: Function, ...args: any[]): Casper;
|
||||
toString(): string;
|
||||
userAgent(agent: string): string;
|
||||
viewport(width: number, height: number): Casper;
|
||||
visible(selector: string): boolean;
|
||||
wait(timeout: number, then?: Function): Casper;
|
||||
waitFor(testFx: Function, then?: Function, onTimeout?: Function, timeout?: number): Casper;
|
||||
waitForPopup(urlPattern: string, then?: Function, onTimeout?: Function, timeout?: number): Casper;
|
||||
waitForPopup(urlPattern: RegExp, then?: Function, onTimeout?: Function, timeout?: number): Casper;
|
||||
waitForSelector(selector: string, then?: Function, onTimeout?: Function, timeout?: number): Casper;
|
||||
waitWhileSelector(selector: string, then?: Function, onTimeout?: Function, timeout?: number): Casper;
|
||||
waitForResource(testFx: Function, then?: Function, onTimeout?: Function, timeout?: number): Casper;
|
||||
waitForText(pattern: string, then?: Function, onTimeout?: Function, timeout?: number): Casper;
|
||||
waitForText(pattern: RegExp, then?: Function, onTimeout?: Function, timeout?: number): Casper;
|
||||
waitUntilVisible(selector: string, then?: Function, onTimeout?: Function, timeout?: number): Casper;
|
||||
waitWhileVisible(selector: string, then?: Function, onTimeout?: Function, timeout?: number): Casper;
|
||||
warn(message: string): Casper;
|
||||
withFrame(frameInfo: string, then: Function): Casper;
|
||||
withFrame(frameInfo: number, then: Function): Casper;
|
||||
withPopup(popupInfo: string, step: Function): Casper;
|
||||
withPopup(popupInfo: RegExp, step: Function): Casper;
|
||||
zoom(factor: number): Casper;
|
||||
}
|
||||
|
||||
interface HttpResponse {
|
||||
@@ -127,96 +138,105 @@ interface ElementInfo {
|
||||
}
|
||||
|
||||
interface CasperOptions {
|
||||
clientScripts: Array;
|
||||
exitOnError: boolean;
|
||||
httpStatusHandlers: any;
|
||||
logLevel: string;
|
||||
onAlert: Function;
|
||||
onDie: Function;
|
||||
onError: Function;
|
||||
onLoadError: Function;
|
||||
onPageInitialized: Function;
|
||||
onResourceReceived: Function;
|
||||
onResourceRequested: Function;
|
||||
onStepComplete: Function;
|
||||
onStepTimeout: Function;
|
||||
onTimeout: Function;
|
||||
onWaitTimeout: Function;
|
||||
page: WebPage;
|
||||
pageSettings: any;
|
||||
remoteScripts: Array;
|
||||
safeLogs: boolean;
|
||||
stepTimeout: number;
|
||||
timeout: number;
|
||||
verbose: boolean;
|
||||
viewportSize: any;
|
||||
waitTimeout: number;
|
||||
clientScripts?: Array;
|
||||
exitOnError?: boolean;
|
||||
httpStatusHandlers?: any;
|
||||
logLevel?: string;
|
||||
onAlert?: Function;
|
||||
onDie?: Function;
|
||||
onError?: Function;
|
||||
onLoadError?: Function;
|
||||
onPageInitialized?: Function;
|
||||
onResourceReceived?: Function;
|
||||
onResourceRequested?: Function;
|
||||
onStepComplete?: Function;
|
||||
onStepTimeout?: Function;
|
||||
onTimeout?: Function;
|
||||
onWaitTimeout?: Function;
|
||||
page?: WebPage;
|
||||
pageSettings?: any;
|
||||
remoteScripts?: Array;
|
||||
safeLogs?: boolean;
|
||||
stepTimeout?: number;
|
||||
timeout?: number;
|
||||
verbose?: boolean;
|
||||
viewportSize?: any;
|
||||
waitTimeout?: number;
|
||||
}
|
||||
|
||||
interface ClientUtils {
|
||||
echo(message: string);
|
||||
encode(contents: string);
|
||||
exists(selector: string);
|
||||
findAll(selector: string);
|
||||
findOne(selector: string);
|
||||
getBase64(url: string, method?: string, data?: any);
|
||||
getBinary(url: string, method?: string, data?: any);
|
||||
getDocumentHeight();
|
||||
getElementBounds(selector: string);
|
||||
getElementsBounds(selector: string);
|
||||
getElementByXPath(expression: string, scope?: HTMLElement);
|
||||
getElementsByXPath(expression: string, scope?: HTMLElement);
|
||||
getFieldValue(inputName: string);
|
||||
getFormValues(selector: string);
|
||||
mouseEvent(type: string, selector: string);
|
||||
removeElementsByXPath(expression: string);
|
||||
sendAJAX(url: string, method?: string, data?: any, async?: boolean);
|
||||
visible(selector: string);
|
||||
echo(message: string): void;
|
||||
encode(contents: string): void;
|
||||
exists(selector: string): void;
|
||||
findAll(selector: string): void;
|
||||
findOne(selector: string): void;
|
||||
getBase64(url: string, method?: string, data?: any): void;
|
||||
getBinary(url: string, method?: string, data?: any): void;
|
||||
getDocumentHeight(): void;
|
||||
getElementBounds(selector: string): void;
|
||||
getElementsBounds(selector: string): void;
|
||||
getElementByXPath(expression: string, scope?: HTMLElement): void;
|
||||
getElementsByXPath(expression: string, scope?: HTMLElement): void;
|
||||
getFieldValue(inputName: string): void;
|
||||
getFormValues(selector: string): void;
|
||||
mouseEvent(type: string, selector: string): void;
|
||||
removeElementsByXPath(expression: string): void;
|
||||
sendAJAX(url: string, method?: string, data?: any, async?: boolean): void;
|
||||
visible(selector: string): void;
|
||||
}
|
||||
|
||||
interface Colorizer {
|
||||
colorize(text: string, styleName: string);
|
||||
format(text: string, style: any);
|
||||
colorize(text: string, styleName: string): void;
|
||||
format(text: string, style: any): void;
|
||||
}
|
||||
|
||||
interface Tester {
|
||||
assert(condition: boolean, message?: string);
|
||||
assertDoesntExist(selector: string, message?: string);
|
||||
assertEquals(testValue: any, expected: any, message?: string);
|
||||
assertEval(fn: Function, message: string, arguments: any);
|
||||
assertEvalEquals(fn: Function, expected: any, message?: string, arguments?: any);
|
||||
assertExists(selector: string, message?: string);
|
||||
assertFalsy(subject: any, message?: string);
|
||||
assertField(inputName: string, expected: string, message?: string);
|
||||
assertHttpStatus(status: number, message?: string);
|
||||
assertMatch(subject: any, pattern: RegExp, message?: string);
|
||||
assertNot(subject: any, message?: string);
|
||||
assertNotEquals(testValue: any, expected: any, message?: string);
|
||||
assertNotVisible(selector: string, message?: string);
|
||||
assertRaises(fn: Function, args: Array, message?: string);
|
||||
assertSelectorDoesntHaveText(selector: string, text: string, message?: string);
|
||||
assertSelectorExists(selector: string, message?: string);
|
||||
assertSelectorHasText(selector: string, text: string, message?: string);
|
||||
assertResourceExists(testFx: Function, message?: string);
|
||||
assertTextExists(expected: string, message?: string);
|
||||
assertTextDoesntExist(unexpected: string, message: string);
|
||||
assertTitle(expected: string, message?: string);
|
||||
assertTitleMatch(pattern: RegExp, message?: string);
|
||||
assertTruthy(subject: any, message?: string);
|
||||
assertType(input: any, type: string, message?: string);
|
||||
assertUrlMatch(pattern: RegExp, message?: string);
|
||||
assertVisible(selector: string, message?: string);
|
||||
colorize(message: string, style: string);
|
||||
comment(message: string);
|
||||
done(expected?: number);
|
||||
error(message: string);
|
||||
fail(message: string);
|
||||
formatMessage(message: string, style: string);
|
||||
assert(condition: boolean, message?: string): any;
|
||||
assertDoesntExist(selector: string, message?: string): any;
|
||||
assertElementCount(selctor: string, expected: number, message?: string): any;
|
||||
assertEquals(testValue: any, expected: any, message?: string): any;
|
||||
assertEval(fn: Function, message: string, arguments: any): any;
|
||||
assertEvalEquals(fn: Function, expected: any, message?: string, arguments?: any): any;
|
||||
assertExists(selector: string, message?: string): any;
|
||||
assertFalsy(subject: any, message?: string): any;
|
||||
assertField(inputName: string, expected: string, message?: string): any;
|
||||
assertHttpStatus(status: number, message?: string): any;
|
||||
assertMatch(subject: any, pattern: RegExp, message?: string): any;
|
||||
assertNot(subject: any, message?: string): any;
|
||||
assertNotEquals(testValue: any, expected: any, message?: string): any;
|
||||
assertNotVisible(selector: string, message?: string): any;
|
||||
assertRaises(fn: Function, args: Array, message?: string): any;
|
||||
assertSelectorDoesntHaveText(selector: string, text: string, message?: string): any;
|
||||
assertSelectorExists(selector: string, message?: string): any;
|
||||
assertSelectorHasText(selector: string, text: string, message?: string): any;
|
||||
assertResourceExists(testFx: Function, message?: string): any;
|
||||
assertTextExists(expected: string, message?: string): any;
|
||||
assertTextDoesntExist(unexpected: string, message: string): any;
|
||||
assertTitle(expected: string, message?: string): any;
|
||||
assertTitleMatch(pattern: RegExp, message?: string): any;
|
||||
assertTruthy(subject: any, message?: string): any;
|
||||
assertType(input: any, type: string, message?: string): any;
|
||||
assertUrlMatch(pattern: string, message?: string): any;
|
||||
assertUrlMatch(pattern: RegExp, message?: string): any;
|
||||
assertVisible(selector: string, message?: string): any;
|
||||
|
||||
/* since 1.1 */
|
||||
begin(description: string, planned: number, suite: Function): any;
|
||||
begin(description: string, suite: Function): any;
|
||||
begin(description: string, planned: number, config: Object): any;
|
||||
begin(description: string, config: Object): any;
|
||||
|
||||
colorize(message: string, style: string): any;
|
||||
comment(message: string): any;
|
||||
done(expected?: number): any;
|
||||
error(message: string): any;
|
||||
fail(message: string): any;
|
||||
formatMessage(message: string, style: string): any;
|
||||
getFailures(): Cases;
|
||||
getPasses(): Cases;
|
||||
info(message: string);
|
||||
pass(message: string);
|
||||
renderResults(exit: boolean, status: number, save: string);
|
||||
info(message: string): any;
|
||||
pass(message: string): any;
|
||||
renderResults(exit: boolean, status: number, save: string): any;
|
||||
}
|
||||
|
||||
interface Cases {
|
||||
@@ -238,30 +258,30 @@ interface CaseValues {
|
||||
}
|
||||
|
||||
interface Utils {
|
||||
betterTypeOf(input: any);
|
||||
dump(value: any);
|
||||
fileExt(file: string);
|
||||
fillBlanks(text: string, pad: number);
|
||||
format(f: string, ...args: any[]);
|
||||
getPropertyPath(obj: any, path: string);
|
||||
inherits(ctor: any, superCtor: any);
|
||||
isArray(value: any);
|
||||
isCasperObject(value: any);
|
||||
isClipRect(value: any);
|
||||
isFalsy(subject: any);
|
||||
isFunction(value: any);
|
||||
isJsFile(file: string);
|
||||
isNull(value: any);
|
||||
isNumber(value: any);
|
||||
isObject(value: any);
|
||||
isRegExp(value: any);
|
||||
isString(value: any);
|
||||
isTruthy(subject: any);
|
||||
isType(what: any, type: string);
|
||||
isUndefined(value: any);
|
||||
isWebPage(what: any);
|
||||
mergeObjects(origin: any, add: any);
|
||||
node(name: string, attributes: any);
|
||||
serialize(value: any);
|
||||
unique(array: Array);
|
||||
betterTypeOf(input: any): any;
|
||||
dump(value: any): any;
|
||||
fileExt(file: string): any;
|
||||
fillBlanks(text: string, pad: number): any;
|
||||
format(f: string, ...args: any[]): any;
|
||||
getPropertyPath(obj: any, path: string): any;
|
||||
inherits(ctor: any, superCtor: any): any;
|
||||
isArray(value: any): any;
|
||||
isCasperObject(value: any): any;
|
||||
isClipRect(value: any): any;
|
||||
isFalsy(subject: any): any;
|
||||
isFunction(value: any): any;
|
||||
isJsFile(file: string): any;
|
||||
isNull(value: any): any;
|
||||
isNumber(value: any): any;
|
||||
isObject(value: any): any;
|
||||
isRegExp(value: any): any;
|
||||
isString(value: any): any;
|
||||
isTruthy(subject: any): any;
|
||||
isType(what: any, type: string): any;
|
||||
isUndefined(value: any): any;
|
||||
isWebPage(what: any): any;
|
||||
mergeObjects(origin: any, add: any): any;
|
||||
node(name: string, attributes: any): any;
|
||||
serialize(value: any): any;
|
||||
unique(array: Array): any;
|
||||
}
|
||||
|
||||
Vendored
+79
-43
@@ -830,44 +830,11 @@ declare module chrome.events {
|
||||
// Extension
|
||||
////////////////////
|
||||
declare module chrome.extension {
|
||||
interface MessageSender {
|
||||
id: string;
|
||||
tab?: chrome.tabs.Tab;
|
||||
}
|
||||
|
||||
interface Port {
|
||||
postMessage: Function;
|
||||
sender?: MessageSender;
|
||||
onDisconnect: chrome.events.Event;
|
||||
onMessage: chrome.events.Event;
|
||||
name: string;
|
||||
}
|
||||
|
||||
interface FetchProperties {
|
||||
windowId?: number;
|
||||
type?: string;
|
||||
}
|
||||
|
||||
interface ConnectInfo {
|
||||
name?: string;
|
||||
}
|
||||
|
||||
interface ExtensionMessageEvent extends chrome.events.Event {
|
||||
addListener(callback: (message: any, sender: MessageSender, sendResponse: Function) => void): void;
|
||||
}
|
||||
|
||||
interface ExtensionMessageExternalEvent extends chrome.events.Event {
|
||||
addListener(callback: (message: any, sender: MessageSender, sendResponse: Function) => void): void;
|
||||
}
|
||||
|
||||
interface ExtensionConnectEvent extends chrome.events.Event {
|
||||
addListener(callback: (port: Port) => void): void;
|
||||
}
|
||||
|
||||
interface ExtensionConnectExternalEvent extends chrome.events.Event {
|
||||
addListener(callback: (port: Port) => void): void;
|
||||
}
|
||||
|
||||
var inIncognitoContext: boolean;
|
||||
var lastError: Object;
|
||||
|
||||
@@ -876,15 +843,7 @@ declare module chrome.extension {
|
||||
export function setUpdateUrlData(data: string): void;
|
||||
export function getViews(fetchProperties?: FetchProperties): Window[];
|
||||
export function isAllowedFileSchemeAccess(callback: (isAllowedAccess: boolean) => void): void;
|
||||
export function sendMessage(message: any, responseCallback?: (response: any) => void): void;
|
||||
export function sendMessage(extensionId: string, message: any, responseCallback?: (response: any) => void): void;
|
||||
export function connect(extensionId?: string, connectInfo?: ConnectInfo): Port;
|
||||
export function isAllowedIncognitoAccess(callback: (isAllowedAccess) => void): void;
|
||||
|
||||
var onMessage: ExtensionMessageEvent;
|
||||
var onMessageExternal: ExtensionMessageExternalEvent;
|
||||
var onConnect: ExtensionConnectEvent;
|
||||
var onConnectExternal: ExtensionConnectExternalEvent;
|
||||
}
|
||||
|
||||
////////////////////
|
||||
@@ -1461,11 +1420,62 @@ declare module chrome.runtime {
|
||||
var lastError: Object;
|
||||
var id: string;
|
||||
|
||||
interface ConnectInfo {
|
||||
name?: string;
|
||||
}
|
||||
|
||||
interface InstalledDetails {
|
||||
reason: string;
|
||||
previousVersion?: string;
|
||||
}
|
||||
|
||||
interface MessageOptions {
|
||||
includeTlsChannelId?: boolean;
|
||||
}
|
||||
|
||||
interface MessageSender {
|
||||
id: string;
|
||||
tab?: chrome.tabs.Tab;
|
||||
}
|
||||
|
||||
interface PlatformInfo {
|
||||
os: string;
|
||||
arch: string;
|
||||
nacl_arch: string;
|
||||
}
|
||||
|
||||
interface Port {
|
||||
postMessage: Function;
|
||||
sender?: MessageSender;
|
||||
onDisconnect: chrome.events.Event;
|
||||
onMessage: chrome.events.Event;
|
||||
name: string;
|
||||
}
|
||||
|
||||
interface UpdateAvailableDetails {
|
||||
version: string;
|
||||
}
|
||||
|
||||
interface UpdateCheckDetails {
|
||||
version: string;
|
||||
}
|
||||
|
||||
interface ExtensionMessageEvent extends chrome.events.Event {
|
||||
addListener(callback: (message: any, sender: MessageSender, sendResponse: Function) => void): void;
|
||||
}
|
||||
|
||||
interface ExtensionMessageExternalEvent extends chrome.events.Event {
|
||||
addListener(callback: (message: any, sender: MessageSender, sendResponse: Function) => void): void;
|
||||
}
|
||||
|
||||
interface ExtensionConnectEvent extends chrome.events.Event {
|
||||
addListener(callback: (port: Port) => void): void;
|
||||
}
|
||||
|
||||
interface ExtensionConnectExternalEvent extends chrome.events.Event {
|
||||
addListener(callback: (port: Port) => void): void;
|
||||
}
|
||||
|
||||
interface RuntimeSuspendEvent extends chrome.events.Event {
|
||||
addListener(callback: Function): void;
|
||||
}
|
||||
@@ -1484,18 +1494,43 @@ declare module chrome.runtime {
|
||||
interface RuntimeMessageEvent extends chrome.events.Event {
|
||||
addListener(callback: Function): void;
|
||||
}
|
||||
|
||||
interface RuntimeRestartRequiredEvent extends chrome.events.Event {
|
||||
addListener(callback: (reason: string) => void): void;
|
||||
}
|
||||
|
||||
interface RuntimeUpdateAvailableEvent extends chrome.events.Event {
|
||||
addListener(callback: (details: UpdateAvailableDetails) => void): void;
|
||||
}
|
||||
|
||||
export function connect(connectInfo?: ConnectInfo): Port;
|
||||
export function connect(extensionId: string, connectInfo?: ConnectInfo): Port;
|
||||
export function connectNative(application: string): Port;
|
||||
export function getBackgroundPage(callback: (backgroundPage?: Window) => void): void;
|
||||
export function getManifest(): Object;
|
||||
export function getPackageDirectoryEntry(callback: (directoryEntry: any) => void): void;
|
||||
export function getPlatformInfo(callback: (platformInfo: PlatformInfo) => void): void;
|
||||
export function getURL(path: string): string;
|
||||
|
||||
export function reload(): void;
|
||||
export function requestUpdateCheck(callback: (status: string, details?: UpdateCheckDetails) => void): void;
|
||||
export function restart(): void;
|
||||
export function sendMessage(message: any, responseCallback?: (response: any) => void): void;
|
||||
export function sendMessage(message: any, options: MessageOptions, responseCallback?: (response: any) => void): void;
|
||||
export function sendMessage(extensionId: string, message: any, responseCallback?: (response: any) => void): void;
|
||||
export function sendMessage(extensionId: string, message: any, options: MessageOptions, responseCallback?: (response: any) => void): void;
|
||||
export function sendNativeMessage(application: string, message: any, responseCallback?: (response: any) => void ): void;
|
||||
export function setUninstallUrl(url: string): void;
|
||||
|
||||
var onConnect: ExtensionConnectEvent;
|
||||
var onConnectExternal: ExtensionConnectExternalEvent;
|
||||
var onSuspend: RuntimeSuspendEvent;
|
||||
var onStartup: RuntimeStartupEvent;
|
||||
var onInstalled: RuntimeInstalledEvent;
|
||||
var onSuspendCanceled: RuntimeSuspendCanceledEvent;
|
||||
var onMessage: RuntimeMessageEvent;
|
||||
var onMessageExternal: RuntimeMessageEvent;
|
||||
var sendMessage:(req:any, cb:(resp:any)=>void)=>void;
|
||||
var onRestartRequired: RuntimeRestartRequiredEvent;
|
||||
var onUpdateAvailable: RuntimeUpdateAvailableEvent;
|
||||
|
||||
}
|
||||
|
||||
@@ -1718,6 +1753,7 @@ declare module chrome.tabs {
|
||||
}
|
||||
|
||||
interface TabRemoveInfo {
|
||||
windowId: number;
|
||||
isWindowClosing: boolean;
|
||||
}
|
||||
|
||||
|
||||
Vendored
+6
-6
@@ -2728,13 +2728,13 @@ declare module Ember {
|
||||
(target: any, method: Function): void;
|
||||
begin(): void;
|
||||
cancel(timer: any): void;
|
||||
debounce(target: any, method: Function, wait: number, immediate: boolean): void;
|
||||
debounce(target: any, method: string, wait: number, immediate: boolean): void;
|
||||
debounce(target: any, method: Function, ...args: any[]): void;
|
||||
debounce(target: any, method: string, ...args: any[]): void;
|
||||
end(): void;
|
||||
join(target: any, method: Function, ...any): any;
|
||||
join(target: any, method: string, ...any): any;
|
||||
later(target: any, method: Function, wait: boolean): string;
|
||||
later(target: any, method: string, wait: boolean): string;
|
||||
later(target: any, method: Function, ...args: any[]): string;
|
||||
later(target: any, method: string, ...args: any[]): string;
|
||||
next(target: any, method: Function, ...any): number;
|
||||
next(target: any, method: string, ...any): number;
|
||||
once(target: any, method: Function, ...any): number;
|
||||
@@ -2744,8 +2744,8 @@ declare module Ember {
|
||||
scheduleOnce(queue: string, target: any, method: Function, ...any): void;
|
||||
scheduleOnce(queue: string, target: any, method: string, ...any): void;
|
||||
sync(): void;
|
||||
throttle(target: any, method: Function, spacing: number): void;
|
||||
throttle(target: any, method: string, spacing: number): void;
|
||||
throttle(target: any, method: Function, ...args: any[]): void;
|
||||
throttle(target: any, method: string, ...args: any[]): void;
|
||||
queues: any[];
|
||||
};
|
||||
function runLoadHooks(name: string, object: any): void;
|
||||
|
||||
@@ -0,0 +1,49 @@
|
||||
/// <reference path="flight.d.ts" />
|
||||
declare var el: Element;
|
||||
declare var els: Element[];
|
||||
declare var mixinFn: Function;
|
||||
|
||||
function TestComponent() {
|
||||
var self: Flight.Component = this;
|
||||
|
||||
self.defaultAttrs({
|
||||
fooSelector: '.bar'
|
||||
});
|
||||
|
||||
this.onClick = function (ev: JQueryEventObject, data: Flight.EventData) {
|
||||
var el: HTMLElement = data.el;
|
||||
self.select('fooSelector').addClass('bar');
|
||||
};
|
||||
|
||||
self.around('initialize', function () { });
|
||||
self.before('initialize', function () { });
|
||||
self.after("initialize", function () {
|
||||
|
||||
var $node: JQuery = self.$node;
|
||||
var node: Element = self.node;
|
||||
|
||||
self.on(el, 'click', {});
|
||||
self.on(els, 'click', function () { });
|
||||
self.on(document, 'click', this.onClick);
|
||||
self.on('click', function () { });
|
||||
self.on('click', {
|
||||
fooSelector: this.onClick
|
||||
});
|
||||
|
||||
self.off('click', function () { });
|
||||
self.off(document, 'click');
|
||||
self.off(el, 'click')
|
||||
self.off(els, 'click');
|
||||
|
||||
self.teardown();
|
||||
});
|
||||
}
|
||||
|
||||
flight.component(TestComponent, mixinFn).attachTo(el);
|
||||
flight.component(TestComponent, mixinFn).attachTo($(els));
|
||||
flight.component(TestComponent, mixinFn).attachTo('.test');
|
||||
flight.component(TestComponent, mixinFn).attachTo('.test', {
|
||||
some: 'data'
|
||||
});
|
||||
|
||||
flight.component.teardownAll();
|
||||
Vendored
+238
@@ -0,0 +1,238 @@
|
||||
/// <reference path="../jquery/jquery.d.ts" />
|
||||
|
||||
// Type definitions for Flight 1.1.1
|
||||
// Project: http://flightjs.github.com/flight/
|
||||
// Definitions by: Jonathan Hedrén <https://github.com/jonathanhedren/>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
declare module Flight {
|
||||
|
||||
export interface Base {
|
||||
|
||||
/**
|
||||
* Most Components and Mixins need to define attributes. In Flight,
|
||||
* default values are assigned by passing an object to the defaultAttrs
|
||||
* function.
|
||||
*/
|
||||
defaultAttrs(obj: Object): void;
|
||||
|
||||
/**
|
||||
* The select method takes an attr key as its argument. The value of the
|
||||
* attr must be a CSS Selector. The method will return all matching
|
||||
* elements within the component's node.
|
||||
*
|
||||
* This is a handy alternative to jQuery's this.$node.find() and prevents
|
||||
* accidental access to elements outside of the component's node.
|
||||
*
|
||||
* @param attr
|
||||
*/
|
||||
select(attr: string): JQuery;
|
||||
|
||||
/**
|
||||
* This method is attached to the prototype of every Component; it accepts
|
||||
* the component's node and an options object as arguments. The core
|
||||
* implementation, which is called every time an instance is created, will
|
||||
* assign the node to the instance and override the default attrs with the
|
||||
* options object.
|
||||
*
|
||||
* Components and Mixins will typically augment the core implementation by
|
||||
* supplying a function as an argument to the after method (see the advice
|
||||
* API for more information). This is a good place to set up event
|
||||
* listeners that bind to callbacks.
|
||||
*/
|
||||
initialize(node: any, options: Object): void;
|
||||
|
||||
/**
|
||||
* This allows a component instance to listen to an event and register a
|
||||
* callback to be invoked. Flight will automatically bind the context
|
||||
* (this) of the callback to the component instance.
|
||||
*
|
||||
* @param selector Optional. Specify the DOM node(s) that should listen
|
||||
* for the event. Defaults to the component instance's node value.
|
||||
*
|
||||
* @param eventType The event type to listen for.
|
||||
*
|
||||
* @param handler Either a function (callback) to be invoked, or a map of
|
||||
* targets and callbacks.
|
||||
*/
|
||||
on(eventType: string, handler: Function): void;
|
||||
on(eventType: string, handler: Object): void;
|
||||
on(selector: string, eventType: string, handler: Function): void;
|
||||
on(selector: Document, eventType: string, handler: Function): void;
|
||||
on(selector: Element, eventType: string, handler: Function): void;
|
||||
on(selector: Element[], eventType: string, handler: Function): void;
|
||||
on(selector: string, eventType: string, handler: Object): void;
|
||||
on(selector: Document, eventType: string, handler: Object): void;
|
||||
on(selector: Element, eventType: string, handler: Object): void;
|
||||
on(selector: Element[], eventType: string, handler: Object): void;
|
||||
|
||||
/**
|
||||
* If we no longer want a component instance to listen to an event we can
|
||||
* use the off method to unsubscribe.
|
||||
*
|
||||
* @param selector Optional. The DOM node(s) listening for the event.
|
||||
* Defaults to the component instance's node value.
|
||||
*
|
||||
* @param eventType The event type being listened to.
|
||||
*
|
||||
* @param handler Optional. The function (callback) to detach from the
|
||||
* component instance. Defaults to the detaching all callbacks for the event.
|
||||
*/
|
||||
off(eventType: string, handler?: Function): void;
|
||||
off(selector: string, eventType: string, handler?: Function): void;
|
||||
off(selector: Document, eventType: string, handler?: Function): void;
|
||||
off(selector: Element, eventType: string, handler?: Function): void;
|
||||
off(selector: Element[], eventType: string, handler?: Function): void;
|
||||
off(selector: string, eventType: Object, handler?: Function): void;
|
||||
off(selector: Document, eventType: Object, handler?: Function): void;
|
||||
off(selector: Element, eventType: Object, handler?: Function): void;
|
||||
off(selector: Element[], eventType: Object, handler?: Function): void;
|
||||
off(selector: string, eventType: string, handler?: Object): void;
|
||||
off(selector: Document, eventType: string, handler?: Object): void;
|
||||
off(selector: Element, eventType: string, handler?: Object): void;
|
||||
off(selector: Element[], eventType: string, handler?: Object): void;
|
||||
off(selector: string, eventType: Object, handler?: Object): void;
|
||||
off(selector: Document, eventType: Object, handler?: Object): void;
|
||||
off(selector: Element, eventType: Object, handler?: Object): void;
|
||||
off(selector: Element[], eventType: Object, handler?: Object): void;
|
||||
|
||||
/**
|
||||
* Trigger an event.
|
||||
*
|
||||
* @param selector Optional. The DOM node(s) that the event will be
|
||||
* dispatched to. Defaults to the component instance's node value.
|
||||
*
|
||||
* @param eventType String. The event type to be triggered.
|
||||
*
|
||||
* You can also specify a default function that will be called by the
|
||||
* component, providing that nothing in the event's bubble chain invokes
|
||||
* preventDefault. Default functions in custom events are analagous to the
|
||||
* default actions of native events.
|
||||
*
|
||||
* To define a default function, make the eventType argument an object
|
||||
* that specifies the event's type and a defaultBehavior property. A
|
||||
* common use case is defining default behavior for keyboard events.
|
||||
*
|
||||
* @param eventPayload This is the payload of data that accompanies the event.
|
||||
*/
|
||||
trigger(eventType: string): void;
|
||||
trigger(selector: string, eventType: string, eventPayload?: Object): void;
|
||||
trigger(selector: Document, eventType: string, eventPayload?: Object): void;
|
||||
trigger(selector: Element, eventType: string, eventPayload?: Object): void;
|
||||
trigger(selector: Element[], eventType: string, eventPayload?: Object): void;
|
||||
trigger(eventType: Object): void;
|
||||
trigger(selector: string, eventType: Object, eventPayload?: Object): void;
|
||||
trigger(selector: Document, eventType: Object, eventPayload?: Object): void;
|
||||
trigger(selector: Element, eventType: Object, eventPayload?: Object): void;
|
||||
trigger(selector: Element[], eventType: Object, eventPayload?: Object): void;
|
||||
|
||||
/**
|
||||
* Remove a component instance and its event bindings.
|
||||
*
|
||||
* It's a good idea to teardown components after each unit test - and
|
||||
* teardown is also good for unbinding event listeners when, for example,
|
||||
* the user navigates away from a page.
|
||||
*
|
||||
*/
|
||||
teardown(): void;
|
||||
}
|
||||
|
||||
export interface Advice extends Base {
|
||||
/**
|
||||
* Run the customFunc function after the existingFunc function.
|
||||
*
|
||||
* @param existingFuncName The name of the existing function (existingFunc)
|
||||
* you want to augment.
|
||||
*
|
||||
* customFunc The function to be invoked after existingFunc.
|
||||
*/
|
||||
after(method: string, fn: Function): void;
|
||||
|
||||
/**
|
||||
* Run the existingFunc function in the middle of the customFunc function.
|
||||
* It's similar to underscore's _wrap function).
|
||||
*
|
||||
* @param existingFuncName The name of the existing function (existingFunc)
|
||||
* you want to augment.
|
||||
*
|
||||
* customFunc The function to wrap around existingFunc. The existingFunc
|
||||
* function will be passed to customFunc as an argument.
|
||||
*
|
||||
* The existing function is passed to the custom function as an argument so
|
||||
* that it can be referenced. If the custom function does not call the
|
||||
* existing function then it will replace that function instead of
|
||||
* surrounding it.
|
||||
*/
|
||||
around(method: string, fn: Function): void;
|
||||
|
||||
/**
|
||||
* Run the customFunc function before the existingFunc function.
|
||||
*
|
||||
* @param existingFuncName The name of the existing function (existingFunc)
|
||||
* you want to augment.
|
||||
*
|
||||
* @param customFunc The function to be invoked before existingFunc.
|
||||
*/
|
||||
before(method: string, fn: Function): void;
|
||||
}
|
||||
|
||||
export interface Component extends Base, Advice {
|
||||
node: Element;
|
||||
$node: JQuery;
|
||||
}
|
||||
|
||||
|
||||
export interface AdviceStatic {
|
||||
withAdvice(): Function;
|
||||
}
|
||||
|
||||
export interface ComponentStatic {
|
||||
(...fns: Function[]): ComponentStatic;
|
||||
attachTo(selector: string, options?: Object): void;
|
||||
attachTo(selector: Element, options?: Object): void;
|
||||
attachTo(selector: JQuery, options?: Object): void;
|
||||
teardownAll(): void;
|
||||
}
|
||||
|
||||
export interface ComposeStatic {
|
||||
mixin(base: Object, mixins: Function[]): void;
|
||||
}
|
||||
|
||||
export interface DebugStatic {
|
||||
events: {
|
||||
logAll(): void;
|
||||
logByAction(action: string): void;
|
||||
logByName(name: string): void;
|
||||
logNone(): void;
|
||||
}
|
||||
}
|
||||
|
||||
export interface UtilsStatic {
|
||||
compose(fn1: Function, fn2: Function, ...fns: Function[]): Function;
|
||||
countThen(num: number, base: Function): Function;
|
||||
debounce(func: Function, wait: number, immediate: boolean): Function;
|
||||
delegate(rules: Object): void;
|
||||
isDomObj(obj: Object): boolean;
|
||||
isEnumerable(obj: Object, property: string): boolean;
|
||||
merge(obj1: Object, obj2: Object, deepClone?: boolean): Object;
|
||||
merge(obj1: Object, obj2: Object, ...args: any[]): Object;
|
||||
push(base: Object, extra: Object, protect?: boolean): void;
|
||||
throttle(func: Function, wait: number): Function;
|
||||
toArray(obj: Object, from?: number): Array;
|
||||
uniqueArray(array: Array): Array;
|
||||
}
|
||||
|
||||
export interface EventData {
|
||||
el: HTMLElement;
|
||||
}
|
||||
|
||||
export interface FlightStatic {
|
||||
advice: AdviceStatic;
|
||||
component: ComponentStatic;
|
||||
compose: ComposeStatic;
|
||||
utils: UtilsStatic;
|
||||
}
|
||||
}
|
||||
|
||||
declare var DEBUG: Flight.DebugStatic;
|
||||
declare var flight: Flight.FlightStatic;
|
||||
Vendored
+1
-1
@@ -72,7 +72,7 @@ declare module jquery.flot {
|
||||
}
|
||||
|
||||
interface seriesOptions {
|
||||
color?: number;
|
||||
color?: any; // color or number
|
||||
label?: string;
|
||||
lines?: linesOptions;
|
||||
bars?: barsOptions;
|
||||
|
||||
@@ -22,10 +22,14 @@ Globalize.addCultureInfo("fr", { messages: { "translate": "traduire" } });
|
||||
console.log(Globalize.localize("translate", "fr"));
|
||||
|
||||
Globalize.parseInt("1,234.56");
|
||||
Globalize.parseInt("1.234,56");
|
||||
Globalize.parseInt("1.234,56", 10);
|
||||
Globalize.parseInt("1.234,56", 10, "de");
|
||||
Globalize.parseFloat("1,234.56");
|
||||
Globalize.parseFloat("1.234,56");
|
||||
Globalize.parseFloat("1.234,56", 10);
|
||||
Globalize.parseFloat("1.234,56", 10, "de");
|
||||
Globalize.parseDate("1/2/2003");
|
||||
Globalize.parseDate("15 Jun 2012", "dd MMM yyyy");
|
||||
Globalize.parseDate("15 Jun 2012", ["dd MMM yyyy"]);
|
||||
Globalize.culture("fr");
|
||||
Globalize.parseDate("1/2/2003");
|
||||
|
||||
|
||||
Vendored
+8
-6
@@ -107,14 +107,16 @@ interface GlobalizeStatic {
|
||||
culture(cultureSelector: string): GlobalizeCulture;
|
||||
culture(cultureSelector: string[]): GlobalizeCulture;
|
||||
|
||||
addCultureInfo(cultureName, baseCultureName, info? );
|
||||
addCultureInfo(cultureName: string, baseCultureName, info?);
|
||||
findClosestCulture(cultureSelector: string);
|
||||
format(value, format, cultureSelector? );
|
||||
localize(key, cultureSelector?);
|
||||
format(value: number, format: string, cultureSelector?: string);
|
||||
format(value: Date, format: string, cultureSelector?: string);
|
||||
localize(key: string, cultureSelector?: string);
|
||||
|
||||
parseDate(value: string, formats? , cultureSelector?: string): Date;
|
||||
parseInt(value: string, radix? , cultureSelector?: string): number;
|
||||
parseFloat(value: string, radix? , cultureSelector?: string): number;
|
||||
parseDate(value: string, format?: string, cultureSelector?: string): Date;
|
||||
parseDate(value: string, formats?: string[], cultureSelector?: string): Date;
|
||||
parseInt(value: string, radix?: number, cultureSelector?: string): number;
|
||||
parseFloat(value: string, radix?: number, cultureSelector?: string): number;
|
||||
}
|
||||
|
||||
declare var Globalize: GlobalizeStatic;
|
||||
|
||||
+279
-31
@@ -4,9 +4,28 @@ declare module google {
|
||||
function setOnLoadCallback(handler: Function): void;
|
||||
function setOnLoadCallback(handler: () => void): void;
|
||||
|
||||
//https://developers.google.com/chart/interactive/docs/reference
|
||||
module visualization {
|
||||
//#region DataTable
|
||||
|
||||
// https://developers.google.com/chart/interactive/docs/reference#DataTable
|
||||
export class DataTable {
|
||||
constructor(data?: any, version?: any);
|
||||
addColumn(type: string, label?: string, id?: string): number;
|
||||
addColumn(descriptionObject: DataTableColumnDescription): number;
|
||||
addRow(cellObject: DataObjectCell): number;
|
||||
addRow(cellArray?: any[]): number;
|
||||
addRows(count: number): number;
|
||||
addRows(array: DataObjectCell[][]): number;
|
||||
addRows(array: any[]): number;
|
||||
getFilteredRows(filters: DataTableCellFilter[]): number[];
|
||||
getFormattedValue(rowIndex: number, columnIndex: number): string;
|
||||
getNumberOfColumns(): number;
|
||||
getNumberOfRows(): number;
|
||||
removeRow(rowIndex: number): void;
|
||||
removeRows(rowIndex: number, numberOfRows: number): void;
|
||||
setColumnLabel(columnIndex: number, label: string): void;
|
||||
}
|
||||
|
||||
export interface DataTableColumnDescription {
|
||||
type?: string;
|
||||
@@ -16,10 +35,10 @@ declare module google {
|
||||
pattern?: string;
|
||||
}
|
||||
|
||||
export interface DataObjectCell {
|
||||
v?: any;
|
||||
f?: string;
|
||||
p?: any;
|
||||
export interface DataObject {
|
||||
cols: DataObjectColumn[];
|
||||
rows: DataObjectRow[];
|
||||
p: any;
|
||||
}
|
||||
|
||||
export interface DataObjectColumn {
|
||||
@@ -35,30 +54,52 @@ declare module google {
|
||||
p?: any;
|
||||
}
|
||||
|
||||
export interface DataObject {
|
||||
cols: DataObjectColumn[];
|
||||
rows: DataObjectRow[];
|
||||
p: any;
|
||||
export interface DataTableCellFilter {
|
||||
column: number;
|
||||
}
|
||||
|
||||
export class DataTable {
|
||||
constructor(data?: any, version?: any);
|
||||
addColumn(type: string, label?: string, id?: string): number;
|
||||
addColumn(descriptionObject: DataTableColumnDescription): number;
|
||||
addRow(cellObject: DataObjectCell): number;
|
||||
addRow(cellArray?: any[]): number;
|
||||
addRows(count: number): number;
|
||||
addRows(array: DataObjectCell[][]): number;
|
||||
addRows(array: any[]): number;
|
||||
export interface DataObjectCell {
|
||||
v?: any;
|
||||
f?: string;
|
||||
p?: any;
|
||||
}
|
||||
|
||||
export interface DataTableCellValueFilter extends DataTableCellFilter {
|
||||
value: any;
|
||||
}
|
||||
|
||||
export interface DataTableCellRangeFilter extends DataTableCellFilter {
|
||||
minValue?: any;
|
||||
maxValue?: any;
|
||||
}
|
||||
|
||||
function arrayToDataTable(data: any[]): DataTable;
|
||||
|
||||
//#endregion
|
||||
//#region DataView
|
||||
|
||||
// https://developers.google.com/chart/interactive/docs/reference#DataView
|
||||
export class DataView {
|
||||
constructor(data: DataTable);
|
||||
constructor(data: DataView);
|
||||
setColumns(columnIndexes: number[]): void;
|
||||
}
|
||||
|
||||
//#endregion
|
||||
//#region GeoChart
|
||||
|
||||
//https://google-developers.appspot.com/chart/interactive/docs/gallery/geochart
|
||||
export class GeoChart {
|
||||
constructor(element: Element);
|
||||
draw(chart: DataTable, options: GeoChartOptions): void;
|
||||
|
||||
// https://developers.google.com/chart/interactive/docs/gallery/geochart?hl=fr&csw=1#Methods
|
||||
draw(data: DataTable, options: GeoChartOptions): void;
|
||||
getSelection(): GeoChartSelection[];
|
||||
setSelection(selection: VisualizationSelectionArray[]): void;
|
||||
clearChart(): void;
|
||||
}
|
||||
|
||||
// https://developers.google.com/chart/interactive/docs/gallery/geochart?hl=fr&csw=1#Configuration_Options
|
||||
export interface GeoChartOptions {
|
||||
backgroundColor?: any;
|
||||
colorAxis?: GeoChartColorAxis;
|
||||
@@ -76,11 +117,12 @@ declare module google {
|
||||
tooltip?: GeoChartTooltip;
|
||||
width?: number;
|
||||
}
|
||||
//export interface GeoChartColor {
|
||||
// fill?: string;
|
||||
// stroke?: string;
|
||||
// strokeWidth: number;
|
||||
//}
|
||||
export interface GeoChartAxis {
|
||||
maxSize?: number;
|
||||
maxValue?: number;
|
||||
minSize?: number;
|
||||
minValue?: number;
|
||||
}
|
||||
export interface GeoChartColorAxis extends GeoChartAxis {
|
||||
minValue?: number;
|
||||
maxValue?: number;
|
||||
@@ -102,20 +144,226 @@ declare module google {
|
||||
enable?: boolean;
|
||||
zoomFactor?: number;
|
||||
}
|
||||
export interface GeoChartAxis {
|
||||
maxSize?: number;
|
||||
maxValue?: number;
|
||||
minSize?: number;
|
||||
minValue?: number;
|
||||
}
|
||||
export interface GeoChartTooltip {
|
||||
textStyle?: GeoChartTextStyle;
|
||||
trigger?: string;
|
||||
}
|
||||
export interface GeoChartRegionClickEvent {
|
||||
region: string;
|
||||
}
|
||||
export interface GeoChartSelection {
|
||||
row: number;
|
||||
}
|
||||
|
||||
//#endregion
|
||||
//#region Common
|
||||
|
||||
export interface ChartArea {
|
||||
top: any;
|
||||
left: any;
|
||||
width: any;
|
||||
height: any;
|
||||
}
|
||||
|
||||
export interface ChartTextStyle {
|
||||
color?: string;
|
||||
fontName?: string;
|
||||
fontSize?: number;
|
||||
bold?: boolean;
|
||||
italic?: boolean;
|
||||
}
|
||||
|
||||
export interface ChartLegend {
|
||||
alignment?: string;
|
||||
maxLines?: number;
|
||||
position?: string;
|
||||
textStyle?: ChartTextStyle;
|
||||
}
|
||||
|
||||
// https://google-developers.appspot.com/chart/interactive/docs/animation
|
||||
export interface TransitionAnimation {
|
||||
duration?: number;
|
||||
easing?: string; // linear, in, out, inAndOut
|
||||
}
|
||||
|
||||
export interface ChartAxis {
|
||||
baseline?: number; // This option is only supported for a continuous axis. https://google-developers.appspot.com/chart/interactive/docs/customizing_axes#Terminology
|
||||
baselineColor?: string; // google's documentation on this is wrong, specifies it as a number. The color of the baseline for the horizontal axis. Can be any HTML color string, for example: 'red' or '#00cc00'
|
||||
direction?: number; // The direction in which the values along the horizontal axis grow. Specify -1 to reverse the order of the values.
|
||||
format?: string; // icu pattern set http://icu-project.org/apiref/icu4c/classDecimalFormat.html#_details
|
||||
gridlines?: ChartGridlines;
|
||||
logScale?: boolean;
|
||||
textPosition?: string;
|
||||
textStyle?: ChartTextStyle;
|
||||
ticks?: any[];
|
||||
title?: string;
|
||||
titleTextStyle?: ChartTextStyle;
|
||||
allowContainerBoundaryTextCufoff?: boolean;
|
||||
slantedText?: boolean;
|
||||
slantedTextAngle?: number;
|
||||
maxAlternation?: number;
|
||||
maxTextLines?: number;
|
||||
minTextSpacing?: number;
|
||||
showTextEvery?: number;
|
||||
maxValue?: number;
|
||||
minValue?: number;
|
||||
viewWindowMode?: string;
|
||||
viewWindow?: ChartViewWindow;
|
||||
}
|
||||
|
||||
export interface ChartGridlines {
|
||||
color?: string;
|
||||
count?: number;
|
||||
minorGridlines?: ChartMinorGridlines;
|
||||
}
|
||||
|
||||
export interface ChartMinorGridlines {
|
||||
color?: string;
|
||||
count?: number;
|
||||
}
|
||||
|
||||
export interface ChartViewWindow {
|
||||
max?: number;
|
||||
min?: number;
|
||||
}
|
||||
|
||||
export interface ChartTooltip {
|
||||
isHtml?: boolean;
|
||||
showColorCode?: boolean;
|
||||
textStyle?: ChartTextStyle;
|
||||
trigger?: string;
|
||||
}
|
||||
|
||||
export interface ChartBoundingBox {
|
||||
left: number;
|
||||
top: number;
|
||||
width: number;
|
||||
height: number;
|
||||
}
|
||||
|
||||
export interface ChartLayoutInterface {
|
||||
getBoundingBox(id: string): ChartBoundingBox;
|
||||
getChartAreaBoundingBox(): ChartBoundingBox;
|
||||
getHAxisValue(position: number, axisIndex?: number): number;
|
||||
getVAxisValue(position: number, axisIndex?: number): number;
|
||||
getXLocation(position: number, axisIndex?: number): number;
|
||||
getYLocation(position: number, axisIndex?: number): number;
|
||||
}
|
||||
|
||||
export interface VisualizationSelectionArray {
|
||||
column?: number;
|
||||
row?: number;
|
||||
}
|
||||
|
||||
//#endregion
|
||||
//#region ColumnChart
|
||||
|
||||
// https://google-developers.appspot.com/chart/interactive/docs/gallery/columnchart
|
||||
export class ColumnChart {
|
||||
constructor(element: Element);
|
||||
|
||||
// https://google-developers.appspot.com/chart/interactive/docs/gallery/columnchart#Methods
|
||||
draw(data: DataTable, options?: ColumnChartOptions): void;
|
||||
draw(data: DataView, options?: ColumnChartOptions): void;
|
||||
getChartLayoutInterface(): ChartLayoutInterface;
|
||||
getSelection(): any[];
|
||||
setSelection(selection: any[]): void;
|
||||
clearChart(): void;
|
||||
}
|
||||
|
||||
// https://google-developers.appspot.com/chart/interactive/docs/gallery/columnchart#Configuration_Options
|
||||
export interface ColumnChartOptions {
|
||||
aggregationTarget?: string;
|
||||
animation?: TransitionAnimation;
|
||||
axisTitlesPosition?: string; // in, out, none
|
||||
backgroundColor?: any;
|
||||
bar?: ColumnChartBarOptions;
|
||||
chartArea?: ChartArea;
|
||||
colors?: string[];
|
||||
enableInteractivity?: boolean;
|
||||
focusTarget?: string;
|
||||
fontSize?: number;
|
||||
fontName?: string;
|
||||
hAxis?: ChartAxis;
|
||||
height?: number;
|
||||
isStacked?: boolean;
|
||||
legend?: ChartLegend;
|
||||
reverseCategories?: boolean;
|
||||
selectionMode?: string // single / multiple
|
||||
series?: any;
|
||||
theme?: string;
|
||||
title?: string;
|
||||
titlePosition?: string;
|
||||
titleTextStyle?: ChartTextStyle;
|
||||
tooltip?: ChartTooltip;
|
||||
vAxes?: any;
|
||||
vAxis?: ChartAxis;
|
||||
width?: number;
|
||||
}
|
||||
|
||||
export interface ColumnChartBarOptions {
|
||||
groupWidth: any;
|
||||
}
|
||||
|
||||
//#endregion
|
||||
//#region LineChart
|
||||
|
||||
// https://google-developers.appspot.com/chart/interactive/docs/gallery/linechart
|
||||
export class LineChart {
|
||||
constructor(element: Element);
|
||||
|
||||
// https://google-developers.appspot.com/chart/interactive/docs/gallery/linechart#Methods
|
||||
draw(data: DataTable, options: any): void;
|
||||
draw(data: DataView, options: any): void;
|
||||
getChartLayoutInterface(): ChartLayoutInterface;
|
||||
getSelection(): any[];
|
||||
setSelection(selection: any[]): void;
|
||||
clearChart(): void;
|
||||
}
|
||||
|
||||
// https://google-developers.appspot.com/chart/interactive/docs/gallery/linechart#Configuration_Options
|
||||
export interface LineChartOptions {
|
||||
aggregationTarget?: string;
|
||||
animation?: TransitionAnimation;
|
||||
axisTitlesPosition?: string;
|
||||
backgroundColor?: any;
|
||||
chartArea?: ChartArea;
|
||||
colors?: string[];
|
||||
curveType?: string;
|
||||
enableInteractivity?: boolean;
|
||||
focusTarget?: string;
|
||||
fontSize?: number;
|
||||
fontName?: string;
|
||||
hAxis?: ChartAxis;
|
||||
height?: number;
|
||||
interpolateNulls?: boolean;
|
||||
legend?: ChartLegend;
|
||||
lineWidth?: number;
|
||||
pointSize?: number;
|
||||
reverseCategories?: boolean;
|
||||
selectionMode?: string // single / multiple
|
||||
series?: any;
|
||||
theme?: string;
|
||||
title?: string;
|
||||
titlePosition?: string;
|
||||
titleTextStyle?: ChartTextStyle;
|
||||
tooltip?: ChartTooltip;
|
||||
vAxes?: any;
|
||||
vAxis?: ChartAxis;
|
||||
width?: number;
|
||||
}
|
||||
|
||||
//#endregion
|
||||
//#region Events
|
||||
|
||||
module events {
|
||||
function addListener(chart: any, eventName: string, callback: Function): any;
|
||||
function addListener(chart: any, eventName: string, callback: () => any): any;
|
||||
function addListener(visualization: any, eventName: string, callback: Function): any;
|
||||
function addListener(visualization: any, eventName: string, callback: (...args: any[]) => void): any;
|
||||
function removeListener(listener: any): void;
|
||||
function removeAllListeners(visualization: any): void;
|
||||
function trigger(visualization: any, eventName: string, args?: any): void;
|
||||
}
|
||||
|
||||
//#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
/// <reference path="../jquery/jquery.d.ts" />
|
||||
/// <reference path="jquery.base64.d.ts" />
|
||||
|
||||
var encoded = $.base64.encode("");
|
||||
$.base64.decode(encoded);
|
||||
|
||||
var encodedUTF8 = $.base64.encode("", true);
|
||||
$.base64.decode(encodedUTF8, true);
|
||||
Vendored
+15
@@ -0,0 +1,15 @@
|
||||
// Type definitions for jQuery Plugin - base64 codec
|
||||
// Project: https://github.com/yatt/jquery.base64/
|
||||
// Definitions by: Shinya Mochizuki <https://github.com/enrapt-mochizuki/>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
/// <reference path="../jquery/jquery.d.ts" />
|
||||
|
||||
interface JQueryBase64Static {
|
||||
encode(data: string, isUTF8?: boolean): string;
|
||||
decode(data: string, isUTF8?: boolean): string;
|
||||
}
|
||||
|
||||
interface JQueryStatic {
|
||||
base64: JQueryBase64Static;
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
///<reference path="../jquery/jquery.d.ts" />
|
||||
///<reference path="jquery.cleditor.d.ts" />
|
||||
|
||||
// cribbed from http://premiumsoftware.net/CLEditor/GettingStarted
|
||||
|
||||
$(document).ready(function () { $("#input").cleditor(); });
|
||||
|
||||
$(document).ready(function() {
|
||||
$("#input").cleditor({
|
||||
width: 500, // width not including margins, borders or padding
|
||||
height: 250, // height not including margins, borders or padding
|
||||
controls: // controls to add to the toolbar
|
||||
"bold italic underline strikethrough subscript superscript | font size " +
|
||||
"style | color highlight removeformat | bullets numbering | outdent " +
|
||||
"indent | alignleft center alignright justify | undo redo | " +
|
||||
"rule image link unlink | cut copy paste pastetext | print source",
|
||||
colors: // colors in the color popup
|
||||
"FFF FCC FC9 FF9 FFC 9F9 9FF CFF CCF FCF " +
|
||||
"CCC F66 F96 FF6 FF3 6F9 3FF 6FF 99F F9F " +
|
||||
"BBB F00 F90 FC6 FF0 3F3 6CC 3CF 66C C6C " +
|
||||
"999 C00 F60 FC3 FC0 3C0 0CC 36F 63F C3C " +
|
||||
"666 900 C60 C93 990 090 399 33F 60C 939 " +
|
||||
"333 600 930 963 660 060 366 009 339 636 " +
|
||||
"000 300 630 633 330 030 033 006 309 303",
|
||||
fonts: // font names in the font popup
|
||||
"Arial,Arial Black,Comic Sans MS,Courier New,Narrow,Garamond," +
|
||||
"Georgia,Impact,Sans Serif,Serif,Tahoma,Trebuchet MS,Verdana",
|
||||
sizes: // sizes in the font size popup
|
||||
"1,2,3,4,5,6,7",
|
||||
styles: // styles in the style popup
|
||||
[["Paragraph", "<p>"], ["Header 1", "<h1>"], ["Header 2", "<h2>"],
|
||||
["Header 3", "<h3>"], ["Header 4","<h4>"], ["Header 5","<h5>"],
|
||||
["Header 6","<h6>"]],
|
||||
useCSS: false, // use CSS to style HTML when possible (not supported in ie)
|
||||
docType: // Document type contained within the editor
|
||||
'<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">',
|
||||
docCSSFile: // CSS file used to style the document contained within the editor
|
||||
"",
|
||||
bodyStyle: // style to assign to document body contained within the editor
|
||||
"margin:4px; font:10pt Arial,Verdana; cursor:text"
|
||||
});
|
||||
});
|
||||
Vendored
+98
@@ -0,0 +1,98 @@
|
||||
// Type definitions for jQuery CLEditor Plugin 1.4.3
|
||||
// Project: http://premiumsoftware.net/CLEditor
|
||||
// Definitions by: Jeffery Grajkowski <https://github.com/pushplay/>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
///<reference path="../jquery/jquery.d.ts" />
|
||||
|
||||
/**
|
||||
* An editor is composed of a main div element used to hold a toolbar,
|
||||
* a text area and an iframe. The toolbar can hold multiple groups
|
||||
* which in turn hold multiple buttons.
|
||||
*/
|
||||
interface CLEditor {
|
||||
$area: JQuery;
|
||||
$frame: JQuery;
|
||||
$main: JQuery;
|
||||
$toolbar: JQuery;
|
||||
disabled: boolean;
|
||||
doc: Document;
|
||||
options: JQueryCLEditorOptions;
|
||||
change(handler: Function): CLEditor;
|
||||
clear(): CLEditor;
|
||||
disable(disabled: boolean): CLEditor;
|
||||
execCommand(commands: string, value: any, useCSS?: boolean, button?: any): CLEditor;
|
||||
focus(): CLEditor;
|
||||
hidePopups(): CLEditor;
|
||||
refresh(): CLEditor;
|
||||
select(): CLEditor;
|
||||
selectedHTML(): string;
|
||||
selectedText(): string;
|
||||
showMessage(message: string, button?: any): CLEditor;
|
||||
sourceMode(): boolean;
|
||||
updateFrame(): CLEditor;
|
||||
updateTextArea(): CLEditor;
|
||||
}
|
||||
|
||||
interface JQueryCLEditorOptions {
|
||||
width?: number;
|
||||
height?: number;
|
||||
controls?: string;
|
||||
colors?: string;
|
||||
fonts?: string;
|
||||
sizes?: string;
|
||||
styles?: string[][];
|
||||
useCSS?: boolean;
|
||||
docType?: string;
|
||||
docCSSFile?: string;
|
||||
bodyStyle?: string;
|
||||
}
|
||||
|
||||
interface JQueryCLEditorButtonDefinition {
|
||||
name: string;
|
||||
title: string;
|
||||
css?: any;
|
||||
image?: string;
|
||||
stripIndex?: number;
|
||||
command?: string;
|
||||
popupName?: string;
|
||||
popupContent?: string;
|
||||
getEnabled?: (data: JQueryCLEditorButtonDefinitionEventData) => boolean;
|
||||
getPressed?: (data: JQueryCLEditorButtonDefinitionEventData) => boolean;
|
||||
buttonClick?: (event: Event, data: JQueryCLEditorButtonDefinitionEventData) => boolean;
|
||||
popupClick?: (event: Event, data: JQueryCLEditorButtonDefinitionEventData) => boolean;
|
||||
}
|
||||
|
||||
interface JQueryCLEditorButtonDefinitionEventData {
|
||||
editor: CLEditor;
|
||||
button: HTMLElement;
|
||||
buttonName: string;
|
||||
popup: HTMLElement;
|
||||
popupName: string;
|
||||
command: string;
|
||||
value: any;
|
||||
useCSS: boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
* This object contains global properties and methods used to create
|
||||
* custom plugins and override built in functionality.
|
||||
*/
|
||||
interface JQueryCLEditorStatic {
|
||||
defaultOptions: JQueryCLEditorOptions;
|
||||
buttons: JQueryCLEditorButtonDefinition[];
|
||||
imagesPath: () => string;
|
||||
}
|
||||
|
||||
interface JQueryStatic {
|
||||
cleditor: JQueryCLEditorStatic;
|
||||
}
|
||||
|
||||
interface JQuery {
|
||||
/**
|
||||
* If the cleditor object does not exist for a matched textarea element,
|
||||
* it will be created using the default options combined with the supplied options.
|
||||
* This is the core method for creating and selecting cleditor objects.
|
||||
*/
|
||||
cleditor(options?: JQueryCLEditorOptions): CLEditor;
|
||||
}
|
||||
Vendored
+2
-2
@@ -73,7 +73,7 @@ declare module JQueryUI {
|
||||
}
|
||||
|
||||
interface Autocomplete extends Widget, AutocompleteOptions, AutocompleteEvents {
|
||||
escapeRegex: (string) => string;
|
||||
escapeRegex: (value: string) => string;
|
||||
}
|
||||
|
||||
|
||||
@@ -154,7 +154,7 @@ declare module JQueryUI {
|
||||
|
||||
interface Datepicker extends Widget, DatepickerOptions {
|
||||
regional: { [languageCod3: string]: any; };
|
||||
setDefaults(defaults: DatepickerOptions);
|
||||
setDefaults(defaults: DatepickerOptions): void;
|
||||
formatDate(format: string, date: Date, settings?: DatepickerFormatDateOptions): string;
|
||||
parseDate(format: string, date: string, settings?: DatepickerFormatDateOptions): Date;
|
||||
iso8601Week(date: Date): void;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/// <reference path="knockout.es5.d.ts" />
|
||||
/// <reference path="knockout.es5.d.ts" />
|
||||
|
||||
var empty = {},
|
||||
obj = { a: 'string', b: 123, c: true, d: empty },
|
||||
@@ -75,3 +75,12 @@ anOrder.lines.shift();
|
||||
|
||||
console.log(someOrderLine.subtotal == someOrderLine.getSubtotal()); // true
|
||||
console.log(anOrder.lines.length); // 1
|
||||
|
||||
//Array methods
|
||||
anOrder.lines.remove(someOrderLine);
|
||||
anOrder.lines.removeAll([someOrderLine]);
|
||||
anOrder.lines.removeAll();
|
||||
|
||||
anOrder.lines.destroy(someOrderLine);
|
||||
anOrder.lines.destroyAll([someOrderLine]);
|
||||
anOrder.lines.destroyAll();
|
||||
Vendored
+16
-1
@@ -8,7 +8,22 @@
|
||||
interface KnockoutStatic {
|
||||
track(obj: any, propertyNames?: Array<string>): any;
|
||||
defineProperty(obj: any, propertyName: string, evaluator: Function): any;
|
||||
defineProperty(obj: any, propertyName: string, options: { get: () => any; set?: (value: any) => void; }): any;
|
||||
defineProperty(obj: any, propertyName: string, options: KnockoutDefinePropertyOptions): any;
|
||||
getObservable(obj: any, propertyName: string): KnockoutObservable<any>;
|
||||
valueHasMutated(obj: any, propertyName: string): void;
|
||||
}
|
||||
|
||||
interface KnockoutDefinePropertyOptions {
|
||||
get(): any;
|
||||
set?(value: any): void;
|
||||
}
|
||||
|
||||
interface Array<T> {
|
||||
remove(item): T[];
|
||||
removeAll(items: T[]): T[];
|
||||
removeAll(): T[];
|
||||
|
||||
destroy(item: T): void;
|
||||
destroyAll(items: T[]): void;
|
||||
destroyAll(): void;
|
||||
}
|
||||
+8
@@ -19,6 +19,14 @@ interface KnockoutObservable<T> {
|
||||
syncWith(topic: string, initializeWithLatestValue?: boolean, skipInitialPublish?: boolean, equalityComparer?: (newValue: T, oldValue: T) => boolean): KnockoutObservable<T>;
|
||||
}
|
||||
|
||||
interface KnockoutObservableArray<T> {
|
||||
subscribeTo(topic: string, useLastPublishedValueToInitialize?: boolean, transform?: (val: any) => T): KnockoutObservableArray<T>;
|
||||
unsubscribeFrom(topic: string): KnockoutObservableArray<T>;
|
||||
publishOn(topic: string, skipInitialPublish?: boolean, equalityComparer?: (newValue: T, oldValue: T) => boolean): KnockoutObservableArray<T>;
|
||||
stopPublishingOn(topic: string): KnockoutObservableArray<T>;
|
||||
syncWith(topic: string, initializeWithLatestValue?: boolean, skipInitialPublish?: boolean, equalityComparer?: (newValue: T, oldValue: T) => boolean): KnockoutObservableArray<T>;
|
||||
}
|
||||
|
||||
interface KnockoutStatic {
|
||||
postbox: KnockoutPostBox;
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
/// <reference path="knockout.rx.d.ts"/>
|
||||
|
||||
var ax: Rx.IObservable<number>;
|
||||
|
||||
var ao = ax.toKoObservable();
|
||||
|
||||
ao(100);
|
||||
ao.getSubscriptionsCount();
|
||||
|
||||
ao.toObservable();
|
||||
ao.toObservable("change");
|
||||
ao.toObservable<Error>("error");
|
||||
@@ -0,0 +1 @@
|
||||
""
|
||||
Vendored
+26
@@ -0,0 +1,26 @@
|
||||
// Type definitions for knockout.rx 0.1
|
||||
// Project: https://github.com/Igorbek/knockout.rx
|
||||
// Definitions by: Igor Oleinikov <https://github.com/Igorbek>
|
||||
|
||||
/// <reference path="../knockout/knockout.d.ts"/>
|
||||
/// <reference path="../rx.js/rx.js.d.ts"/>
|
||||
|
||||
interface KnockoutSubscribableFunctions<T> {
|
||||
toObservable(event?: string): Rx.IObservable<T>;
|
||||
toObservable<TEvent>(event: string): Rx.IObservable<TEvent>;
|
||||
}
|
||||
|
||||
interface KnockoutObservableFunctions<T> {
|
||||
toObservableWithReplyLatest(): Rx.IObservable<T>;
|
||||
}
|
||||
|
||||
interface KnockoutComputedFunctions<T> {
|
||||
toObservableWithReplyLatest(): Rx.IObservable<T>;
|
||||
}
|
||||
|
||||
declare module Rx {
|
||||
interface IObservable<T> {
|
||||
toKoSubscribable(): KnockoutSubscribable<T>;
|
||||
toKoObservable(initialValue?: T): KnockoutObservable<T>;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
""
|
||||
Vendored
+22
-12
@@ -24,10 +24,10 @@ declare module 'knockout' {
|
||||
export function isObservable(instance: any): boolean;
|
||||
export function isComputed(instance: any): boolean;
|
||||
export function dataFor(node: any): any;
|
||||
export function removeNode(node: Element);
|
||||
export function cleanNode(node: Element);
|
||||
export function renderTemplate(template: Function, viewModel: any, options?: any, target?: any, renderMode?: any);
|
||||
export function renderTemplate(template: string, viewModel: any, options?: any, target?: any, renderMode?: any);
|
||||
export function removeNode(node: Element): void;
|
||||
export function cleanNode(node: Element): Element;
|
||||
export function renderTemplate(template: Function, viewModel: any, options?: any, target?: any, renderMode?: any): any;
|
||||
export function renderTemplate(template: string, viewModel: any, options?: any, target?: any, renderMode?: any): any;
|
||||
|
||||
//////////////////////////////////
|
||||
//// templateSources.js
|
||||
@@ -44,9 +44,10 @@ declare module 'knockout' {
|
||||
//// templateRewriting.js
|
||||
////////////////////////////////////
|
||||
export var templateRewriting: {
|
||||
ensureTemplateIsRewritten(template, templateEngine, templateDocument);
|
||||
memoizeBindingAttributeSyntax(htmlString: string, templateEngine: KnockoutTemplateEngine);
|
||||
applyMemoizedBindingsToNextSibling(bindings);
|
||||
ensureTemplateIsRewritten(template: Node, templateEngine: KnockoutTemplateEngine, templateDocument: Document): any;
|
||||
ensureTemplateIsRewritten(template: string, templateEngine: KnockoutTemplateEngine, templateDocument: Document): any;
|
||||
memoizeBindingAttributeSyntax(htmlString: string, templateEngine: KnockoutTemplateEngine): any;
|
||||
applyMemoizedBindingsToNextSibling(bindings: any, nodeName: string): string;
|
||||
};
|
||||
////////////////////////////////////
|
||||
//// nativeTemplateEngine.js
|
||||
@@ -61,16 +62,25 @@ declare module 'knockout' {
|
||||
////////////////////////////////////
|
||||
export var jqueryTmplTemplateEngine: {
|
||||
prototype: KnockoutTemplateEngine;
|
||||
renderTemplateSource(templateSource, bindingContext, options);
|
||||
renderTemplateSource(templateSource: Object, bindingContext: KnockoutBindingContext, options: Object): Node[];
|
||||
createJavaScriptEvaluatorBlock(script: string): string;
|
||||
addTemplate(templateName, templateMarkup);
|
||||
addTemplate(templateName: string, templateMarkup: string): void;
|
||||
};
|
||||
////////////////////////////////////
|
||||
//// templating.js
|
||||
////////////////////////////////////
|
||||
export function setTemplateEngine(templateEngine: KnockoutNativeTemplateEngine);
|
||||
export function renderTemplate(template, dataOrBindingContext, options, targetNodeOrNodeArray, renderMode);
|
||||
export function renderTemplateForEach(template, arrayOrObservableArray, options, targetNode, parentBindingContext);
|
||||
export function renderTemplate(template: Function, dataOrBindingContext: KnockoutBindingContext, options: Object, targetNodeOrNodeArray: Node, renderMode: string): any;
|
||||
export function renderTemplate(template: any, dataOrBindingContext: KnockoutBindingContext, options: Object, targetNodeOrNodeArray: Node, renderMode: string): any;
|
||||
export function renderTemplate(template: Function, dataOrBindingContext: any, options: Object, targetNodeOrNodeArray: Node, renderMode: string): any;
|
||||
export function renderTemplate(template: any, dataOrBindingContext: any, options: Object, targetNodeOrNodeArray: Node, renderMode: string): any;
|
||||
export function renderTemplate(template: Function, dataOrBindingContext: KnockoutBindingContext, options: Object, targetNodeOrNodeArray: Node[], renderMode: string): any;
|
||||
export function renderTemplate(template: any, dataOrBindingContext: KnockoutBindingContext, options: Object, targetNodeOrNodeArray: Node[], renderMode: string): any;
|
||||
export function renderTemplate(template: Function, dataOrBindingContext: any, options: Object, targetNodeOrNodeArray: Node[], renderMode: string): any;
|
||||
export function renderTemplate(template: any, dataOrBindingContext: any, options: Object, targetNodeOrNodeArray: Node[], renderMode: string): any;
|
||||
export function renderTemplateForEach(template: Function, arrayOrObservableArray: Array, options: Object, targetNode: Node, parentBindingContext: KnockoutBindingContext): any;
|
||||
export function renderTemplateForEach(template: any, arrayOrObservableArray: Array, options: Object, targetNode: Node, parentBindingContext: KnockoutBindingContext): any;
|
||||
export function renderTemplateForEach(template: Function, arrayOrObservableArray: KnockoutObservable<Array>, options: Object, targetNode: Node, parentBindingContext: KnockoutBindingContext): any;
|
||||
export function renderTemplateForEach(template: any, arrayOrObservableArray: KnockoutObservable < Array>, options: Object, targetNode: Node, parentBindingContext: KnockoutBindingContext): any;
|
||||
export var expressionRewriting: {
|
||||
bindingRewriteValidators: any;
|
||||
};
|
||||
|
||||
Vendored
+81
-68
@@ -5,7 +5,7 @@
|
||||
|
||||
|
||||
interface KnockoutSubscribableFunctions<T> {
|
||||
notifySubscribers(valueToWrite: T, event?: string);
|
||||
notifySubscribers(valueToWrite: T, event?: string): void;
|
||||
}
|
||||
|
||||
interface KnockoutComputedFunctions<T> {
|
||||
@@ -27,12 +27,13 @@ interface KnockoutObservableArrayFunctions<T> {
|
||||
unshift(...items: T[]): number;
|
||||
reverse(): T[];
|
||||
sort(): void;
|
||||
sort(compareFunction): void;
|
||||
sort(compareFunction: (left: any, right: any) => number): void;
|
||||
|
||||
// Ko specific
|
||||
replace(oldItem: T, newItem: T): void;
|
||||
|
||||
remove(item): T[];
|
||||
remove(item: T): T[];
|
||||
remove(removeFunction: (item: T) => boolean): T[];
|
||||
removeAll(items: T[]): T[];
|
||||
removeAll(): T[];
|
||||
|
||||
@@ -52,10 +53,8 @@ interface KnockoutSubscription {
|
||||
}
|
||||
|
||||
interface KnockoutSubscribable<T> extends KnockoutSubscribableFunctions<T> {
|
||||
(): T;
|
||||
(value: T): void;
|
||||
|
||||
subscribe(callback: (newValue: T) => void, target?: any, event?: string): KnockoutSubscription;
|
||||
subscribe<TEvent>(callback: (newValue: TEvent) => void, target: any, event: string): KnockoutSubscription;
|
||||
extend(requestedExtenders: { [key: string]: any; }): KnockoutSubscribable<T>;
|
||||
getSubscriptionsCount(): number;
|
||||
}
|
||||
@@ -70,10 +69,14 @@ interface KnockoutComputedStatic {
|
||||
}
|
||||
|
||||
interface KnockoutComputed<T> extends KnockoutSubscribable<T>, KnockoutComputedFunctions<T> {
|
||||
(): T;
|
||||
(value: T): void;
|
||||
|
||||
peek(): T;
|
||||
dispose(): void;
|
||||
isActive(): boolean;
|
||||
getDependenciesCount(): number;
|
||||
extend(requestedExtenders: { [key: string]: any; }): KnockoutComputed<T>;
|
||||
}
|
||||
|
||||
interface KnockoutObservableArrayStatic {
|
||||
@@ -83,6 +86,7 @@ interface KnockoutObservableArrayStatic {
|
||||
}
|
||||
|
||||
interface KnockoutObservableArray<T> extends KnockoutObservable<T[]>, KnockoutObservableArrayFunctions<T> {
|
||||
extend(requestedExtenders: { [key: string]: any; }): KnockoutObservableArray<T>;
|
||||
}
|
||||
|
||||
interface KnockoutObservableStatic {
|
||||
@@ -92,9 +96,13 @@ interface KnockoutObservableStatic {
|
||||
}
|
||||
|
||||
interface KnockoutObservable<T> extends KnockoutSubscribable<T>, KnockoutObservableFunctions<T> {
|
||||
(): T;
|
||||
(value: T): void;
|
||||
|
||||
peek(): T;
|
||||
valueHasMutated(): void;
|
||||
valueWillMutate(): void;
|
||||
extend(requestedExtenders: { [key: string]: any; }): KnockoutObservable<T>;
|
||||
}
|
||||
|
||||
interface KnockoutComputedDefine<T> {
|
||||
@@ -114,8 +122,8 @@ interface KnockoutBindingContext {
|
||||
$index?: number;
|
||||
$parentContext?: KnockoutBindingContext;
|
||||
|
||||
extend(any): any;
|
||||
createChildContext(any): any;
|
||||
extend(properties: any): any;
|
||||
createChildContext(dataItemOrAccessor: any, dataItemAlias?: any, extendCallback?: Function): any;
|
||||
}
|
||||
|
||||
interface KnockoutBindingHandler {
|
||||
@@ -159,23 +167,23 @@ interface KnockoutBindingHandlers {
|
||||
}
|
||||
|
||||
interface KnockoutMemoization {
|
||||
memoize(callback);
|
||||
unmemoize(memoId, callbackParams);
|
||||
unmemoizeDomNodeAndDescendants(domNode, extraCallbackParamsArray);
|
||||
parseMemoText(memoText);
|
||||
memoize(callback: () => string): string;
|
||||
unmemoize(memoId: string, callbackParams: Array): boolean;
|
||||
unmemoizeDomNodeAndDescendants(domNode: any, extraCallbackParamsArray: Array): boolean;
|
||||
parseMemoText(memoText: string): string;
|
||||
}
|
||||
|
||||
interface KnockoutVirtualElement {}
|
||||
|
||||
interface KnockoutVirtualElements {
|
||||
allowedBindings: { [bindingName: string]: boolean; };
|
||||
emptyNode( e: KnockoutVirtualElement );
|
||||
firstChild( e: KnockoutVirtualElement );
|
||||
insertAfter( container: KnockoutVirtualElement, nodeToInsert: HTMLElement, insertAfter: HTMLElement );
|
||||
nextSibling( e: KnockoutVirtualElement );
|
||||
prepend( e: KnockoutVirtualElement, toInsert: HTMLElement );
|
||||
setDomNodeChildren( e: KnockoutVirtualElement, newChildren: { length: number;[index: number]: HTMLElement; } );
|
||||
childNodes( e: KnockoutVirtualElement ): HTMLElement[];
|
||||
emptyNode(node: KnockoutVirtualElement ): void;
|
||||
firstChild(node: KnockoutVirtualElement ): KnockoutVirtualElement;
|
||||
insertAfter( container: KnockoutVirtualElement, nodeToInsert: HTMLElement, insertAfter: HTMLElement ): void;
|
||||
nextSibling(node: KnockoutVirtualElement): HTMLElement;
|
||||
prepend(node: KnockoutVirtualElement, toInsert: HTMLElement ): void;
|
||||
setDomNodeChildren(node: KnockoutVirtualElement, newChildren: { length: number;[index: number]: HTMLElement; } ): void;
|
||||
childNodes(node: KnockoutVirtualElement ): HTMLElement[];
|
||||
}
|
||||
|
||||
interface KnockoutExtenders {
|
||||
@@ -189,11 +197,11 @@ interface KnockoutUtils {
|
||||
// utils.domManipulation.js
|
||||
//////////////////////////////////
|
||||
|
||||
simpleHtmlParse(html: string);
|
||||
simpleHtmlParse(html: string): Array;
|
||||
|
||||
jQueryHtmlParse(html: string);
|
||||
jQueryHtmlParse(html: string): Array;
|
||||
|
||||
parseHtmlFragment(html: string);
|
||||
parseHtmlFragment(html: string): Array;
|
||||
|
||||
setHtml(node: Element, html: string): void;
|
||||
|
||||
@@ -204,13 +212,13 @@ interface KnockoutUtils {
|
||||
//////////////////////////////////
|
||||
|
||||
domData: {
|
||||
get (node: Element, key: string);
|
||||
get (node: Element, key: string): any;
|
||||
|
||||
set (node: Element, key: string, value: any);
|
||||
set (node: Element, key: string, value: any): void;
|
||||
|
||||
getAll(node: Element, createIfNotFound: boolean);
|
||||
getAll(node: Element, createIfNotFound: boolean): any;
|
||||
|
||||
clear(node: Element);
|
||||
clear(node: Element): boolean;
|
||||
};
|
||||
|
||||
//////////////////////////////////
|
||||
@@ -218,13 +226,13 @@ interface KnockoutUtils {
|
||||
//////////////////////////////////
|
||||
|
||||
domNodeDisposal: {
|
||||
addDisposeCallback(node: Element, callback: Function);
|
||||
addDisposeCallback(node: Element, callback: Function): void;
|
||||
|
||||
removeDisposeCallback(node: Element, callback: Function);
|
||||
removeDisposeCallback(node: Element, callback: Function): void;
|
||||
|
||||
cleanNode(node: Element);
|
||||
cleanNode(node: Element): Element;
|
||||
|
||||
removeNode(node: Element);
|
||||
removeNode(node: Element): void;
|
||||
};
|
||||
|
||||
//////////////////////////////////
|
||||
@@ -233,41 +241,29 @@ interface KnockoutUtils {
|
||||
|
||||
fieldsIncludedWithJsonPost: any[];
|
||||
|
||||
arrayForEach<T>(array: T[], action: (item: T) => void): void;
|
||||
compareArrays<T>(a: T[], b: T[]): Array<KnockoutArrayChange<T>>;
|
||||
|
||||
arrayForEach(array: any[], action: (any) => void ): void;
|
||||
arrayForEach<T>(array: T[], action: (item: T) => void): void;
|
||||
|
||||
arrayIndexOf(array: any[], item: any): number;
|
||||
|
||||
arrayFirst<T>(array: T[], predicate: (item: T) => boolean, predicateOwner?: any): T;
|
||||
|
||||
arrayFirst(array: any[], predicate: (item) => boolean, predicateOwner?: any): any;
|
||||
|
||||
arrayRemoveItem(array: any[], itemToRemove: any): void;
|
||||
|
||||
arrayGetDistinctValues<T>(array: T[]): T[];
|
||||
|
||||
arrayGetDistinctValues(array: any[]): any[];
|
||||
|
||||
arrayMap<T, U>(array: T[], mapping: (item: T) => U): U[];
|
||||
|
||||
arrayMap(array: any[], mapping: (item) => any): any[];
|
||||
|
||||
arrayFilter<T>(array: T[], predicate: (item: T) => boolean): T[];
|
||||
|
||||
arrayFilter(array: any[], predicate: (item) => boolean): any[];
|
||||
|
||||
arrayPushAll<T>(array: T[], valuesToPush: T[]): T[];
|
||||
|
||||
arrayPushAll(array: any[], valuesToPush: any[]): any[];
|
||||
|
||||
arrayPushAll<T>(array: KnockoutObservableArray<T>, valuesToPush: T[]): T[];
|
||||
|
||||
arrayPushAll(array: KnockoutObservableArray<any>, valuesToPush: any[]): any[];
|
||||
extend(target: Object, source: Object): Object;
|
||||
|
||||
extend(target, source);
|
||||
|
||||
emptyDomNode(domNode): void;
|
||||
emptyDomNode(domNode: HTMLElement): void;
|
||||
|
||||
moveCleanedNodesToContainerElement(nodes: any[]): HTMLElement;
|
||||
|
||||
@@ -328,15 +324,21 @@ interface KnockoutUtils {
|
||||
isIe7: boolean;
|
||||
}
|
||||
|
||||
interface KnockoutArrayChange<T> {
|
||||
status: string;
|
||||
value: T;
|
||||
index: number;
|
||||
}
|
||||
|
||||
//////////////////////////////////
|
||||
// templateSources.js
|
||||
//////////////////////////////////
|
||||
|
||||
interface KnockoutTemplateSourcesDomElement {
|
||||
|
||||
text(valueToWrite?);
|
||||
text(valueToWrite?: any): any;
|
||||
|
||||
data(key, valueToWrite?);
|
||||
data(key: string, valueToWrite?: any): any;
|
||||
}
|
||||
|
||||
|
||||
@@ -358,7 +360,7 @@ interface KnockoutTemplateSources {
|
||||
|
||||
interface KnockoutNativeTemplateEngine {
|
||||
|
||||
renderTemplateSource(templateSource, bindingContext, options?);
|
||||
renderTemplateSource(templateSource: Object, bindingContext?: KnockoutBindingContext, options?: Object): Array;
|
||||
}
|
||||
|
||||
//////////////////////////////////
|
||||
@@ -367,15 +369,15 @@ interface KnockoutNativeTemplateEngine {
|
||||
|
||||
interface KnockoutTemplateEngine extends KnockoutNativeTemplateEngine {
|
||||
|
||||
createJavaScriptEvaluatorBlock(script: string);
|
||||
createJavaScriptEvaluatorBlock(script: string): string;
|
||||
|
||||
makeTemplateSource(template, templateDocument);
|
||||
makeTemplateSource(template: any, templateDocument?: Document): any;
|
||||
|
||||
renderTemplate(template, bindingContext, options, templateDocument);
|
||||
renderTemplate(template: any, bindingContext: KnockoutBindingContext, options: Object, templateDocument: Document): any;
|
||||
|
||||
isTemplateRewritten(template, templateDocument): boolean;
|
||||
isTemplateRewritten(template: any, templateDocument: Document): boolean;
|
||||
|
||||
rewriteTemplate(template, rewriterCallback, templateDocument);
|
||||
rewriteTemplate(template: any, rewriterCallback: Function, templateDocument: Document): void;
|
||||
}
|
||||
|
||||
/////////////////////////////////
|
||||
@@ -404,10 +406,10 @@ interface KnockoutStatic {
|
||||
isWriteableObservable(instance: any): boolean;
|
||||
isComputed(instance: any): boolean;
|
||||
dataFor(node: any): any;
|
||||
removeNode(node: Element);
|
||||
cleanNode(node: Element);
|
||||
renderTemplate(template: Function, viewModel: any, options?: any, target?: any, renderMode?: any);
|
||||
renderTemplate(template: string, viewModel: any, options?: any, target?: any, renderMode?: any);
|
||||
removeNode(node: Element): void;
|
||||
cleanNode(node: Element): Element;
|
||||
renderTemplate(template: Function, viewModel: any, options?: any, target?: any, renderMode?: any): any;
|
||||
renderTemplate(template: string, viewModel: any, options?: any, target?: any, renderMode?: any): any;
|
||||
unwrap(value: any): any;
|
||||
|
||||
//////////////////////////////////
|
||||
@@ -433,11 +435,12 @@ interface KnockoutStatic {
|
||||
|
||||
templateRewriting: {
|
||||
|
||||
ensureTemplateIsRewritten(template, templateEngine, templateDocument);
|
||||
ensureTemplateIsRewritten(template: Node, templateEngine: KnockoutTemplateEngine, templateDocument: Document): any;
|
||||
ensureTemplateIsRewritten(template: string, templateEngine: KnockoutTemplateEngine, templateDocument: Document): any;
|
||||
|
||||
memoizeBindingAttributeSyntax(htmlString: string, templateEngine: KnockoutTemplateEngine);
|
||||
memoizeBindingAttributeSyntax(htmlString: string, templateEngine: KnockoutTemplateEngine): any;
|
||||
|
||||
applyMemoizedBindingsToNextSibling(bindings);
|
||||
applyMemoizedBindingsToNextSibling(bindings: any, nodeName: string): string;
|
||||
};
|
||||
|
||||
//////////////////////////////////
|
||||
@@ -461,22 +464,32 @@ interface KnockoutStatic {
|
||||
|
||||
prototype: KnockoutTemplateEngine;
|
||||
|
||||
renderTemplateSource(templateSource, bindingContext, options);
|
||||
renderTemplateSource(templateSource: Object, bindingContext: KnockoutBindingContext, options: Object): Node[];
|
||||
|
||||
createJavaScriptEvaluatorBlock(script: string): string;
|
||||
|
||||
addTemplate(templateName, templateMarkup);
|
||||
addTemplate(templateName: string, templateMarkup: string): void;
|
||||
};
|
||||
|
||||
//////////////////////////////////
|
||||
// templating.js
|
||||
//////////////////////////////////
|
||||
|
||||
setTemplateEngine(templateEngine: KnockoutNativeTemplateEngine);
|
||||
setTemplateEngine(templateEngine: KnockoutNativeTemplateEngine): void;
|
||||
|
||||
renderTemplate(template, dataOrBindingContext, options, targetNodeOrNodeArray, renderMode);
|
||||
renderTemplate(template: Function, dataOrBindingContext: KnockoutBindingContext, options: Object, targetNodeOrNodeArray: Node, renderMode: string): any;
|
||||
renderTemplate(template: any, dataOrBindingContext: KnockoutBindingContext, options: Object, targetNodeOrNodeArray: Node, renderMode: string): any;
|
||||
renderTemplate(template: Function, dataOrBindingContext: any, options: Object, targetNodeOrNodeArray: Node, renderMode: string): any;
|
||||
renderTemplate(template: any, dataOrBindingContext: any, options: Object, targetNodeOrNodeArray: Node, renderMode: string): any;
|
||||
renderTemplate(template: Function, dataOrBindingContext: KnockoutBindingContext, options: Object, targetNodeOrNodeArray: Node[], renderMode: string): any;
|
||||
renderTemplate(template: any, dataOrBindingContext: KnockoutBindingContext, options: Object, targetNodeOrNodeArray: Node[], renderMode: string): any;
|
||||
renderTemplate(template: Function, dataOrBindingContext: any, options: Object, targetNodeOrNodeArray: Node[], renderMode: string): any;
|
||||
renderTemplate(template: any, dataOrBindingContext: any, options: Object, targetNodeOrNodeArray: Node[], renderMode: string): any;
|
||||
|
||||
renderTemplateForEach(template, arrayOrObservableArray, options, targetNode, parentBindingContext);
|
||||
renderTemplateForEach(template: Function, arrayOrObservableArray: Array, options: Object, targetNode: Node, parentBindingContext: KnockoutBindingContext): any;
|
||||
renderTemplateForEach(template: any, arrayOrObservableArray: Array, options: Object, targetNode: Node, parentBindingContext: KnockoutBindingContext): any;
|
||||
renderTemplateForEach(template: Function, arrayOrObservableArray: KnockoutObservable<Array>, options: Object, targetNode: Node, parentBindingContext: KnockoutBindingContext): any;
|
||||
renderTemplateForEach(template: any, arrayOrObservableArray: KnockoutObservable<Array>, options: Object, targetNode: Node, parentBindingContext: KnockoutBindingContext): any;
|
||||
|
||||
expressionRewriting: {
|
||||
bindingRewriteValidators: any;
|
||||
@@ -492,9 +505,9 @@ interface KnockoutStatic {
|
||||
|
||||
selectExtensions: {
|
||||
|
||||
readValue(element: any);
|
||||
readValue(element: HTMLElement): any;
|
||||
|
||||
writeValue(element: any, value: any);
|
||||
writeValue(element: HTMLElement, value: any): void;
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
Vendored
+3510
-2455
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,929 @@
|
||||
/// <reference path="lodash.d.ts" />
|
||||
|
||||
declare var $: any, jQuery: any;
|
||||
|
||||
interface IFoodOrganic {
|
||||
name: string;
|
||||
organic: boolean;
|
||||
}
|
||||
|
||||
interface IFoodType {
|
||||
name: string;
|
||||
type: string;
|
||||
}
|
||||
|
||||
interface IFoodCombined {
|
||||
name: string;
|
||||
organic: boolean;
|
||||
type: string;
|
||||
}
|
||||
|
||||
interface IStoogesQuote {
|
||||
name: string;
|
||||
quotes: string[];
|
||||
}
|
||||
|
||||
interface IStoogesAge {
|
||||
name: string;
|
||||
age: number;
|
||||
}
|
||||
|
||||
interface IStoogesCombined {
|
||||
name: string;
|
||||
age: number;
|
||||
quotes: string[];
|
||||
}
|
||||
|
||||
interface IKey {
|
||||
dir: string;
|
||||
code: number;
|
||||
}
|
||||
|
||||
var foodsOrganic: IFoodOrganic[] = [
|
||||
{ name: 'banana', organic: true },
|
||||
{ name: 'beet', organic: false },
|
||||
];
|
||||
var foodsType: IFoodType[] = [
|
||||
{ name: 'apple', type: 'fruit' },
|
||||
{ name: 'banana', type: 'fruit' },
|
||||
{ name: 'beet', type: 'vegetable' }
|
||||
];
|
||||
var foodsCombined: IFoodCombined[] = [
|
||||
{ 'name': 'apple', 'organic': false, 'type': 'fruit' },
|
||||
{ 'name': 'carrot', 'organic': true, 'type': 'vegetable' }
|
||||
];
|
||||
|
||||
var stoogesQuotes: IStoogesQuote[] = [
|
||||
{ 'name': 'curly', 'quotes': ['Oh, a wise guy, eh?', 'Poifect!'] },
|
||||
{ 'name': 'moe', 'quotes': ['Spread out!', 'You knucklehead!'] }
|
||||
];
|
||||
var stoogesAges: IStoogesAge[] = [
|
||||
{ 'name': 'moe', 'age': 40 },
|
||||
{ 'name': 'larry', 'age': 50 }
|
||||
];
|
||||
|
||||
var stoogesCombined: IStoogesCombined[] = [
|
||||
{ 'name': 'curly', 'age': 30, 'quotes': ['Oh, a wise guy, eh?', 'Poifect!'] },
|
||||
{ 'name': 'moe', 'age': 40, 'quotes': ['Spread out!', 'You knucklehead!'] }
|
||||
];
|
||||
|
||||
var keys: IKey[] = [
|
||||
{ 'dir': 'left', 'code': 97 },
|
||||
{ 'dir': 'right', 'code': 100 }
|
||||
];
|
||||
|
||||
class Dog {
|
||||
constructor(public name: string) {}
|
||||
|
||||
public bark() {
|
||||
console.log('Woof, woof!');
|
||||
}
|
||||
}
|
||||
|
||||
var result : any;
|
||||
|
||||
/*************
|
||||
* Chaining *
|
||||
*************/
|
||||
result = <_.LoDashWrapper<string>>_('test');
|
||||
result = <_.LoDashWrapper<number>>_(1);
|
||||
result = <_.LoDashWrapper<boolean>>_(true);
|
||||
result = <_.LoDashArrayWrapper<string>>_(['test1', 'test2']);
|
||||
result = <_.LoDashObjectWrapper<_.Dictionary<string>>>_({'key1': 'test1', 'key2': 'test2'});
|
||||
|
||||
result = <_.LoDashWrapper<string>>_.chain('test');
|
||||
result = <_.LoDashWrapper<string>>_('test').chain();
|
||||
result = <_.LoDashWrapper<number>>_.chain(1);
|
||||
result = <_.LoDashWrapper<number>>_(1).chain();
|
||||
result = <_.LoDashWrapper<boolean>>_.chain(true);
|
||||
result = <_.LoDashWrapper<boolean>>_(true).chain();
|
||||
result = <_.LoDashArrayWrapper<string>>_.chain(['test1', 'test2']);
|
||||
result = <_.LoDashArrayWrapper<string>>_(['test1', 'test2']).chain();
|
||||
result = <_.LoDashObjectWrapper<_.Dictionary<string>>>_.chain({'key1': 'test1', 'key2': 'test2'});
|
||||
result = <_.LoDashObjectWrapper<_.Dictionary<string>>>_({'key1': 'test1', 'key2': 'test2'}).chain();
|
||||
|
||||
//Wrapped array shortcut methods
|
||||
result = <_.LoDashArrayWrapper<number>>_([1, 2, 3, 4]).concat(5, 6);
|
||||
result = <_.LoDashWrapper<string>>_([1, 2, 3, 4]).join(',');
|
||||
result = <_.LoDashWrapper<number>>_([1, 2, 3, 4]).pop();
|
||||
_([1, 2, 3, 4]).push(5, 6, 7);
|
||||
result = <_.LoDashArrayWrapper<number>>_([1, 2, 3, 4]).reverse();
|
||||
result = <_.LoDashWrapper<number>>_([1, 2, 3, 4]).shift();
|
||||
result = <_.LoDashArrayWrapper<number>>_([1, 2, 3, 4]).slice(1, 2);
|
||||
result = <_.LoDashArrayWrapper<number>>_([1, 2, 3, 4]).slice(2);
|
||||
result = <_.LoDashArrayWrapper<number>>_([1, 2, 3, 4]).sort((a, b) => 1);
|
||||
result = <_.LoDashArrayWrapper<number>>_([1, 2, 3, 4]).splice(1);
|
||||
result = <_.LoDashArrayWrapper<number>>_([1, 2, 3, 4]).splice(1, 2, 5, 6);
|
||||
result = <_.LoDashWrapper<number>>_([1, 2, 3, 4]).unshift(5, 6);
|
||||
|
||||
result = <number[]>_.tap([1, 2, 3, 4], function(array) { console.log(array); });
|
||||
result = <_.LoDashWrapper<string>>_('test').tap(function(value) { console.log(value); });
|
||||
result = <_.LoDashArrayWrapper<number>>_([1, 2, 3, 4]).tap(function(array) { console.log(array); });
|
||||
result = <_.LoDashObjectWrapper<_.Dictionary<string>>>_({'key1': 'test1', 'key2': 'test2'}).tap(function(array) { console.log(array); });
|
||||
|
||||
result = <string>_('test').toString();
|
||||
result = <string>_([1, 2, 3]).toString();
|
||||
result = <string>_({'key1': 'test1', 'key2': 'test2'}).toString();
|
||||
|
||||
result = <string>_('test').valueOf();
|
||||
result = <number[]>_([1, 2, 3]).valueOf();
|
||||
result = <_.Dictionary<string>>_({'key1': 'test1', 'key2': 'test2'}).valueOf();
|
||||
|
||||
result = <string>_('test').value();
|
||||
result = <number[]>_([1, 2, 3]).value();
|
||||
result = <_.Dictionary<string>>_({'key1': 'test1', 'key2': 'test2'}).value();
|
||||
|
||||
// /*************
|
||||
// * Arrays *
|
||||
// *************/
|
||||
result = <any[]>_.compact([0, 1, false, 2, '', 3]);
|
||||
result = <_.LoDashArrayWrapper<any>>_([0, 1, false, 2, '', 3]).compact();
|
||||
|
||||
result = <number[]>_.difference([1, 2, 3, 4, 5], [5, 2, 10]);
|
||||
result = <_.LoDashArrayWrapper<number>>_([1, 2, 3, 4, 5]).difference([5, 2, 10]);
|
||||
|
||||
result = <number[]>_.rest([1, 2, 3]);
|
||||
result = <number[]>_.rest([1, 2, 3], 2);
|
||||
result = <number[]>_.rest([1, 2, 3], (num) => num < 3)
|
||||
result = <IFoodOrganic[]>_.rest(foodsOrganic, 'test');
|
||||
result = <IFoodType[]>_.rest(foodsType, { 'type': 'value' });
|
||||
|
||||
result = <number[]>_.drop([1, 2, 3]);
|
||||
result = <number[]>_.drop([1, 2, 3], 2);
|
||||
result = <number[]>_.drop([1, 2, 3], (num) => num < 3)
|
||||
result = <IFoodOrganic[]>_.drop(foodsOrganic, 'test');
|
||||
result = <IFoodType[]>_.drop(foodsType, { 'type': 'value' });
|
||||
|
||||
result = <number[]>_.tail([1, 2, 3])
|
||||
result = <number[]>_.tail([1, 2, 3], 2)
|
||||
result = <number[]>_.tail([1, 2, 3], (num) => num < 3)
|
||||
result = <IFoodOrganic[]>_.tail(foodsOrganic, 'test')
|
||||
result = <IFoodType[]> _.tail(foodsType, { 'type': 'value' })
|
||||
|
||||
result = <number>_.findIndex(['apple', 'banana', 'beet'], function(f) {
|
||||
return /^b/.test(f);
|
||||
});
|
||||
result = <number>_.findIndex(['apple', 'banana', 'beet'], 'apple');
|
||||
result = <number>_.findIndex([{ food: 'apple' }, { food: 'banana' }, { food: 'beet' }], { food: 'apple'});
|
||||
|
||||
result = <number>_.findLastIndex(['apple', 'banana', 'beet'], function(f: string) {
|
||||
return /^b/.test(f);
|
||||
});
|
||||
result = <number>_.findLastIndex(['apple', 'banana', 'beet'], 'apple');
|
||||
result = <number>_.findLastIndex([{ food: 'apple' }, { food: 'banana' }, { food: 'beet' }], { food: 'apple'});
|
||||
|
||||
result = <number>_.first([1, 2, 3]);
|
||||
result = <number[]>_.first([1, 2, 3], 2);
|
||||
result = <number[]>_.first([1, 2, 3], function(num) {
|
||||
return num < 3;
|
||||
});
|
||||
result = <IFoodOrganic[]>_.first(foodsOrganic, 'organic');
|
||||
result = <IFoodType[]>_.first(foodsType, { 'type': 'fruit' });
|
||||
|
||||
result = <number>_.head([1, 2, 3]);
|
||||
result = <number[]>_.head([1, 2, 3], 2);
|
||||
result = <number[]>_.head([1, 2, 3], function(num) {
|
||||
return num < 3;
|
||||
});
|
||||
result = <IFoodOrganic[]>_.head(foodsOrganic, 'organic');
|
||||
result = <IFoodType[]>_.head(foodsType, { 'type': 'fruit' });
|
||||
|
||||
result = <number>_.take([1, 2, 3]);
|
||||
result = <number[]>_.take([1, 2, 3], 2);
|
||||
result = <number[]>_.take([1, 2, 3], (num) => num < 3);
|
||||
result = <IFoodOrganic[]>_.take(foodsOrganic, 'organic');
|
||||
result = <IFoodType[]>_.take(foodsType, { 'type': 'fruit' });
|
||||
|
||||
result = <number[]>_.flatten([1, [2], [3, [[4]]]]);
|
||||
result = <any[]>_.flatten([1, [2], [3, [[4]]]], true);
|
||||
var result: any
|
||||
result = <string[]>_.flatten(stoogesQuotes, 'quotes');
|
||||
|
||||
result = <_.LoDashArrayWrapper<number>>_([1, [2], [3, [[4]]]]).flatten();
|
||||
result = <_.LoDashArrayWrapper<number>>_([1, [2], [3, [[4]]]]).flatten(true);
|
||||
result = <_.LoDashArrayWrapper<string>>_(stoogesQuotes).flatten('quotes');
|
||||
|
||||
result = <number>_.indexOf([1, 2, 3, 1, 2, 3], 2);
|
||||
result = <number>_.indexOf([1, 2, 3, 1, 2, 3], 2, 3);
|
||||
result = <number>_.indexOf([1, 1, 2, 2, 3, 3], 2, true);
|
||||
|
||||
result = <number[]>_.initial([1, 2, 3]);
|
||||
result = <number[]>_.initial([1, 2, 3], 2);
|
||||
result = <number[]>_.initial([1, 2, 3], function(num) {
|
||||
return num > 1;
|
||||
});
|
||||
result = <IFoodOrganic[]>_.initial(foodsOrganic, 'organic');
|
||||
result = <IFoodType[]>_.initial(foodsType, { 'type': 'vegetable' });
|
||||
|
||||
result = <number[]>_.intersection([1, 2, 3], [101, 2, 1, 10], [2, 1]);
|
||||
|
||||
result = <number>_.last([1, 2, 3]);
|
||||
result = <number[]>_.last([1, 2, 3], 2);
|
||||
result = <number[]>_.last([1, 2, 3], function(num) {
|
||||
return num > 1;
|
||||
});
|
||||
result = <IFoodOrganic[]>_.last(foodsOrganic, 'organic');
|
||||
result = <IFoodType[]>_.last(foodsType, { 'type': 'vegetable' });
|
||||
|
||||
result = <number>_.lastIndexOf([1, 2, 3, 1, 2, 3], 2);
|
||||
result = <number>_.lastIndexOf([1, 2, 3, 1, 2, 3], 2, 3);
|
||||
|
||||
result = <{[key: string]: any}>_.zipObject(['moe', 'larry'], [30, 40]);
|
||||
result = <{[key: string]: any}>_.object(['moe', 'larry'], [30, 40]);
|
||||
|
||||
result = <any[]>_.pull([1, 2, 3, 1, 2, 3], 2, 3);
|
||||
|
||||
result = <number[]>_.range(10);
|
||||
result = <number[]>_.range(1, 11);
|
||||
result = <number[]>_.range(0, 30, 5);
|
||||
result = <number[]>_.range(0, -10, -1);
|
||||
result = <number[]>_.range(1, 4, 0);
|
||||
result = <number[]>_.range(0);
|
||||
|
||||
result = <number[]>_.remove([1, 2, 3, 4, 5, 6], function(num: number) { return num % 2 == 0; });
|
||||
result = <IFoodOrganic[]>_.remove(foodsOrganic, 'organic');
|
||||
result = <IFoodType[]>_.remove(foodsType, { 'type': 'vegetable'});
|
||||
|
||||
result = <number>_.sortedIndex([20, 30, 50], 40);
|
||||
result = <number>_.sortedIndex([{ 'x': 20 }, { 'x': 30 }, { 'x': 50 }], { 'x': 40 }, 'x');
|
||||
var sortedIndexDict = {
|
||||
'wordToNumber': { 'twenty': 20, 'thirty': 30, 'fourty': 40, 'fifty': 50 }
|
||||
};
|
||||
result = <number>_.sortedIndex(['twenty', 'thirty', 'fifty'], 'fourty', function(word) {
|
||||
return sortedIndexDict.wordToNumber[word];
|
||||
});
|
||||
result = <number>_.sortedIndex(['twenty', 'thirty', 'fifty'], 'fourty', function(word) {
|
||||
return this.wordToNumber[word];
|
||||
}, sortedIndexDict);
|
||||
|
||||
result = <number[]>_.union([1, 2, 3], [101, 2, 1, 10], [2, 1]);
|
||||
|
||||
result = <number[]>_.uniq([1, 2, 1, 3, 1]);
|
||||
result = <number[]>_.uniq([1, 1, 2, 2, 3], true);
|
||||
result = <string[]>_.uniq(['A', 'b', 'C', 'a', 'B', 'c'], function(letter) {
|
||||
return letter.toLowerCase();
|
||||
});
|
||||
result = <number[]>_.uniq([1, 2.5, 3, 1.5, 2, 3.5], function(num) { return this.floor(num); }, Math);
|
||||
result = <{x: number;}[]>_.uniq([{ 'x': 1 }, { 'x': 2 }, { 'x': 1 }], 'x');
|
||||
|
||||
result = <number[]>_.unique([1, 2, 1, 3, 1]);
|
||||
result = <number[]>_.unique([1, 1, 2, 2, 3], true);
|
||||
result = <string[]>_.unique(['A', 'b', 'C', 'a', 'B', 'c'], function(letter) {
|
||||
return letter.toLowerCase();
|
||||
});
|
||||
result = <number[]>_.unique([1, 2.5, 3, 1.5, 2, 3.5], function(num) { return this.floor(num); }, Math);
|
||||
result = <{x: number;}[]>_.unique([{ 'x': 1 }, { 'x': 2 }, { 'x': 1 }], 'x');
|
||||
|
||||
result = <number[]>_.without([1, 2, 1, 0, 3, 1, 4], 0, 1);
|
||||
|
||||
result = <any[][]>_.zip(['moe', 'larry'], [30, 40], [true, false]);
|
||||
result = <any[][]>_.unzip(['moe', 'larry'], [30, 40], [true, false]);
|
||||
|
||||
// /* *************
|
||||
// * Collections *
|
||||
// ************* */
|
||||
|
||||
result = <string[]>_.at(['a', 'b', 'c', 'd', 'e'], [0, 2, 4]);
|
||||
result = <string[]>_.at(['moe', 'larry', 'curly'], 0, 2);
|
||||
|
||||
result = <boolean>_.contains([1, 2, 3], 1);
|
||||
result = <boolean>_.contains([1, 2, 3], 1, 2);
|
||||
result = <boolean>_.contains({ 'name': 'moe', 'age': 40 }, 'moe');
|
||||
result = <boolean>_.contains('curly', 'ur');
|
||||
|
||||
result = <boolean>_.include([1, 2, 3], 1);
|
||||
result = <boolean>_.include([1, 2, 3], 1, 2);
|
||||
result = <boolean>_.include({ 'name': 'moe', 'age': 40 }, 'moe');
|
||||
result = <boolean>_.include('curly', 'ur');
|
||||
|
||||
result = <_.Dictionary<number>>_.countBy([4.3, 6.1, 6.4], function(num) { return Math.floor(num); });
|
||||
result = <_.Dictionary<number>>_.countBy([4.3, 6.1, 6.4], function(num) { return this.floor(num); }, Math);
|
||||
result = <_.Dictionary<number>>_.countBy(['one', 'two', 'three'], 'length');
|
||||
|
||||
result = <_.LoDashObjectWrapper<_.Dictionary<number>>>_([4.3, 6.1, 6.4]).countBy(function(num) { return Math.floor(num); });
|
||||
result = <_.LoDashObjectWrapper<_.Dictionary<number>>>_([4.3, 6.1, 6.4]).countBy(function(num) { return this.floor(num); }, Math);
|
||||
result = <_.LoDashObjectWrapper<_.Dictionary<number>>>_(['one', 'two', 'three']).countBy('length');
|
||||
|
||||
result = <boolean>_.every([true, 1, null, 'yes'], Boolean);
|
||||
result = <boolean>_.every(stoogesAges, 'age');
|
||||
result = <boolean>_.every(stoogesAges, { 'age': 50 });
|
||||
|
||||
result = <boolean>_.all([true, 1, null, 'yes'], Boolean);
|
||||
result = <boolean>_.all(stoogesAges, 'age');
|
||||
result = <boolean>_.all(stoogesAges, { 'age': 50 });
|
||||
|
||||
result = <number[]>_.filter([1, 2, 3, 4, 5, 6], function(num) { return num % 2 == 0; });
|
||||
result = <IFoodCombined[]>_.filter(foodsCombined, 'organic');
|
||||
result = <IFoodCombined[]>_.filter(foodsCombined, { 'type': 'fruit' });
|
||||
|
||||
result = <number[]>_([1, 2, 3, 4, 5, 6]).filter(function(num) { return num % 2 == 0; });
|
||||
result = <IFoodCombined[]>_(foodsCombined).filter('organic');
|
||||
result = <IFoodCombined[]>_(foodsCombined).filter({ 'type': 'fruit' });
|
||||
|
||||
result = <number[]>_.select([1, 2, 3, 4, 5, 6], function(num) { return num % 2 == 0; });
|
||||
result = <IFoodCombined[]>_.select(foodsCombined, 'organic');
|
||||
result = <IFoodCombined[]>_.select(foodsCombined, { 'type': 'fruit' });
|
||||
|
||||
result = <number[]>_([1, 2, 3, 4, 5, 6]).select(function(num) { return num % 2 == 0; });
|
||||
result = <IFoodCombined[]>_(foodsCombined).select('organic');
|
||||
result = <IFoodCombined[]>_(foodsCombined).select({ 'type': 'fruit' });
|
||||
|
||||
result = <number>_.find([1, 2, 3, 4], function(num) {
|
||||
return num % 2 == 0;
|
||||
});
|
||||
result = <IFoodCombined>_.find(foodsCombined, { 'type': 'vegetable' });
|
||||
result = <IFoodCombined>_.find(foodsCombined, 'organic');
|
||||
|
||||
result = <number>_.detect([1, 2, 3, 4], function(num) {
|
||||
return num % 2 == 0;
|
||||
});
|
||||
result = <IFoodCombined>_.detect(foodsCombined, { 'type': 'vegetable' });
|
||||
result = <IFoodCombined>_.detect(foodsCombined, 'organic');
|
||||
|
||||
result = <number>_.findWhere([1, 2, 3, 4], function(num) {
|
||||
return num % 2 == 0;
|
||||
});
|
||||
result = <IFoodCombined>_.findWhere(foodsCombined, { 'type': 'vegetable' });
|
||||
result = <IFoodCombined>_.findWhere(foodsCombined, 'organic');
|
||||
|
||||
result = <number>_.findLast([1, 2, 3, 4], function(num) {
|
||||
return num % 2 == 0;
|
||||
});
|
||||
result = <IFoodCombined>_.findLast(foodsCombined, { 'type': 'vegetable' });
|
||||
result = <IFoodCombined>_.findLast(foodsCombined, 'organic');
|
||||
|
||||
result = <number[]>_.forEach([1, 2, 3], function(num) { console.log(num); });
|
||||
result = <_.Dictionary<number>>_.forEach({ 'one': 1, 'two': 2, 'three': 3 }, function(num) { console.log(num); });
|
||||
|
||||
result = <number[]>_.each([1, 2, 3], function(num) { console.log(num); });
|
||||
result = <_.Dictionary<number>>_.each({ 'one': 1, 'two': 2, 'three': 3 }, function(num) { console.log(num); });
|
||||
|
||||
result = <_.LoDashArrayWrapper<number>>_([1, 2, 3]).forEach(function(num) { console.log(num); });
|
||||
result = <_.LoDashObjectWrapper<_.Dictionary<number>>>_({ 'one': 1, 'two': 2, 'three': 3 }).forEach(function(num) { console.log(num); });
|
||||
|
||||
result = <_.LoDashArrayWrapper<number>>_([1, 2, 3]).each(function(num) { console.log(num); });
|
||||
result = <_.LoDashObjectWrapper<_.Dictionary<number>>>_({ 'one': 1, 'two': 2, 'three': 3 }).each(function(num) { console.log(num); });
|
||||
|
||||
result = <number[]>_.forEachRight([1, 2, 3], function(num) { console.log(num); });
|
||||
result = <_.Dictionary<number>>_.forEachRight({ 'one': 1, 'two': 2, 'three': 3 }, function(num) { console.log(num); });
|
||||
|
||||
result = <number[]>_.eachRight([1, 2, 3], function(num) { console.log(num); });
|
||||
result = <_.Dictionary<number>>_.eachRight({ 'one': 1, 'two': 2, 'three': 3 }, function(num) { console.log(num); });
|
||||
|
||||
result = <_.LoDashArrayWrapper<number>>_([1, 2, 3]).forEachRight(function(num) { console.log(num); });
|
||||
result = <_.LoDashObjectWrapper<_.Dictionary<number>>>_({ 'one': 1, 'two': 2, 'three': 3 }).forEachRight(function(num) { console.log(num); });
|
||||
|
||||
result = <_.LoDashArrayWrapper<number>>_([1, 2, 3]).eachRight(function(num) { console.log(num); });
|
||||
result = <_.LoDashObjectWrapper<_.Dictionary<number>>>_({ 'one': 1, 'two': 2, 'three': 3 }).eachRight(function(num) { console.log(num); });
|
||||
|
||||
result = <_.Dictionary<number[]>>_.groupBy([4.2, 6.1, 6.4], function(num) { return Math.floor(num); });
|
||||
result = <_.Dictionary<number[]>>_.groupBy([4.2, 6.1, 6.4], function(num) { return this.floor(num); }, Math);
|
||||
result = <_.Dictionary<string[]>>_.groupBy(['one', 'two', 'three'], 'length');
|
||||
|
||||
result = <_.LoDashObjectWrapper<_.Dictionary<number[]>>>_([4.2, 6.1, 6.4]).groupBy(function(num) { return Math.floor(num); });
|
||||
result = <_.LoDashObjectWrapper<_.Dictionary<number[]>>>_([4.2, 6.1, 6.4]).groupBy(function(num) { return this.floor(num); }, Math);
|
||||
result = <_.LoDashObjectWrapper<_.Dictionary<string[]>>>_(['one', 'two', 'three']).groupBy('length');
|
||||
|
||||
result = <_.Dictionary<IKey>>_.indexBy(keys, 'dir');
|
||||
result = <_.Dictionary<IKey>>_.indexBy(keys, function(key) { return String.fromCharCode(key.code); });
|
||||
result = <_.Dictionary<IKey>>_.indexBy(keys, function(key) { this.fromCharCode(key.code); }, String);
|
||||
|
||||
result = <any[]>_.invoke([[5, 1, 7], [3, 2, 1]], 'sort');
|
||||
result = <any[]>_.invoke([123, 456], String.prototype.split, '');
|
||||
|
||||
result = <any[]>_.map([1, 2, 3], function(num) { return num * 3; });
|
||||
result = <any[]>_.map({ 'one': 1, 'two': 2, 'three': 3 }, function(num) { return num * 3; });
|
||||
result = <any[]>_.map(stoogesAges, 'name');
|
||||
|
||||
result = <any[]>_.collect([1, 2, 3], function(num) { return num * 3; });
|
||||
result = <any[]>_.collect({ 'one': 1, 'two': 2, 'three': 3 }, function(num) { return num * 3; });
|
||||
result = <any[]>_.collect(stoogesAges, 'name');
|
||||
|
||||
result = <number>_.max([4, 2, 8, 6]);
|
||||
result = <IStoogesAge>_.max(stoogesAges, function(stooge) { return stooge.age; });
|
||||
result = <IStoogesAge>_.max(stoogesAges, 'age');
|
||||
|
||||
result = <number>_.min([4, 2, 8, 6]);
|
||||
result = <IStoogesAge>_.min(stoogesAges, function(stooge) { return stooge.age; });
|
||||
result = <IStoogesAge>_.min(stoogesAges, 'age');
|
||||
|
||||
result = <string[]>_.pluck(stoogesAges, 'name');
|
||||
|
||||
result = <number>_.reduce<number, number>([1, 2, 3], function(sum: number, num: number) {
|
||||
return sum + num;
|
||||
});
|
||||
result = <any>_.reduce<number, any>({ 'a': 1, 'b': 2, 'c': 3 }, function(r: any, num: number, key: string) {
|
||||
r[key] = num * 3;
|
||||
return r;
|
||||
}, {});
|
||||
|
||||
result = <any>_.foldl([1, 2, 3], function(sum: number, num: number) {
|
||||
return sum + num;
|
||||
});
|
||||
result = <any>_.foldl({ 'a': 1, 'b': 2, 'c': 3 }, function(r: any, num: number, key: string) {
|
||||
r[key] = num * 3;
|
||||
return r;
|
||||
}, {});
|
||||
|
||||
result = <any>_.inject([1, 2, 3], function(sum: number, num: number) {
|
||||
return sum + num;
|
||||
});
|
||||
result = <any>_.inject({ 'a': 1, 'b': 2, 'c': 3 }, function(r: any, num: number, key: string) {
|
||||
r[key] = num * 3;
|
||||
return r;
|
||||
}, {});
|
||||
|
||||
result = <any>_.reduceRight([[0, 1], [2, 3], [4, 5]], function(a: number[], b: number[]) { return a.concat(b); }, []);
|
||||
result = <any>_.foldr([[0, 1], [2, 3], [4, 5]], function(a: number[], b: number[]) { return a.concat(b); }, []);
|
||||
|
||||
result = <number[]>_.reject([1, 2, 3, 4, 5, 6], function(num) { return num % 2 == 0; });
|
||||
result = <IFoodCombined[]>_.reject(foodsCombined, 'organic');
|
||||
result = <IFoodCombined[]>_.reject(foodsCombined, { 'type': 'fruit' });
|
||||
|
||||
result = <number>_.sample([1, 2, 3, 4]);
|
||||
result = <number[]>_.sample([1, 2, 3, 4], 2);
|
||||
|
||||
result = <number[]>_.shuffle([1, 2, 3, 4, 5, 6]);
|
||||
|
||||
result = <number>_.size([1, 2]);
|
||||
result = <number>_.size({ 'one': 1, 'two': 2, 'three': 3 });
|
||||
result = <number>_.size('curly');
|
||||
|
||||
result = <boolean>_.some([null, 0, 'yes', false], Boolean);
|
||||
result = <boolean>_.some(foodsCombined, 'organic');
|
||||
result = <boolean>_.some(foodsCombined, { 'type': 'meat' });
|
||||
|
||||
result = <boolean>_.any([null, 0, 'yes', false], Boolean);
|
||||
result = <boolean>_.any(foodsCombined, 'organic');
|
||||
result = <boolean>_.any(foodsCombined, { 'type': 'meat' });
|
||||
|
||||
result = <number[]>_.sortBy([1, 2, 3], function(num) { return Math.sin(num); });
|
||||
result = <number[]>_.sortBy([1, 2, 3], function(num) { return this.sin(num); }, Math);
|
||||
result = <string[]>_.sortBy(['banana', 'strawberry', 'apple'], 'length');
|
||||
|
||||
(function(a: any, b: any, c: any, d: any){ return _.toArray(arguments).slice(1); })(1, 2, 3, 4);
|
||||
|
||||
result = <IStoogesCombined[]>_.where(stoogesCombined, { 'age': 40 });
|
||||
result = <IStoogesCombined[]>_.where(stoogesCombined, { 'quotes': ['Poifect!'] });
|
||||
|
||||
/*************
|
||||
* Functions *
|
||||
*************/
|
||||
var saves = ['profile', 'settings'];
|
||||
var asyncSave = (obj: any) => obj.done();
|
||||
var done: Function;
|
||||
|
||||
done = _.after(saves.length, function() {
|
||||
console.log('Done saving!');
|
||||
});
|
||||
|
||||
_.forEach(saves, function(type) {
|
||||
asyncSave({ 'type': type, 'complete': done });
|
||||
});
|
||||
|
||||
done = _(saves.length).after(function() {
|
||||
console.log('Done saving!');
|
||||
}).value();
|
||||
|
||||
_.forEach(saves, function(type) {
|
||||
asyncSave({ 'type': type, 'complete': done });
|
||||
});
|
||||
|
||||
var funcBind = function (greeting: string) { return greeting + ' ' + this.name };
|
||||
var funcBind2: () => any = _.bind(funcBind, { 'name': 'moe' }, 'hi');
|
||||
funcBind2();
|
||||
|
||||
var funcBind3: () => any = _(funcBind).bind({ 'name': 'moe' }, 'hi').value();
|
||||
funcBind3();
|
||||
|
||||
var view = {
|
||||
'label': 'docs',
|
||||
'onClick': function() { console.log('clicked ' + this.label); }
|
||||
};
|
||||
|
||||
view = _.bindAll(view);
|
||||
jQuery('#docs').on('click', view.onClick);
|
||||
|
||||
view = _(view).bindAll().value();
|
||||
jQuery('#docs').on('click', view.onClick);
|
||||
|
||||
var objectBindKey = {
|
||||
'name': 'moe',
|
||||
'greet': function(greeting: string) {
|
||||
return greeting + ' ' + this.name;
|
||||
}
|
||||
};
|
||||
|
||||
var funcBindKey: Function = _.bindKey(objectBindKey, 'greet', 'hi');
|
||||
funcBindKey();
|
||||
|
||||
objectBindKey.greet = function(greeting) {
|
||||
return greeting + ', ' + this.name + '!';
|
||||
};
|
||||
|
||||
funcBindKey();
|
||||
|
||||
funcBindKey = _(objectBindKey).bindKey('greet', 'hi').value();
|
||||
funcBindKey();
|
||||
|
||||
var realNameMap = {
|
||||
'curly': 'jerome'
|
||||
};
|
||||
|
||||
var format = function(name: string) {
|
||||
name = realNameMap[name.toLowerCase()] || name;
|
||||
return name.charAt(0).toUpperCase() + name.slice(1).toLowerCase();
|
||||
};
|
||||
|
||||
var greet = function(formatted: string) {
|
||||
return 'Hiya ' + formatted + '!';
|
||||
};
|
||||
|
||||
result = <Function>_.compose(greet, format);
|
||||
result = <_.LoDashObjectWrapper<Function>>_(greet).compose(format);
|
||||
|
||||
var createCallbackObj = { name: 'Joe' };
|
||||
result = <() => any>_.createCallback('name');
|
||||
result = <() => boolean>_.createCallback(createCallbackObj);
|
||||
result = <_.LoDashObjectWrapper<() => any>>_('name').createCallback();
|
||||
result = <_.LoDashObjectWrapper<() => boolean>>_(createCallbackObj).createCallback();
|
||||
|
||||
result = <Function>_.curry(function(a, b, c) {
|
||||
console.log(a + b + c);
|
||||
});
|
||||
|
||||
result = <_.LoDashObjectWrapper<Function>>_(function(a, b, c) {
|
||||
console.log(a + b + c);
|
||||
}).curry();
|
||||
|
||||
declare var source: any;
|
||||
result = <Function>_.debounce(function() {}, 150);
|
||||
|
||||
jQuery('#postbox').on('click', <Function>_.debounce(function() {}, 300, {
|
||||
'leading': true,
|
||||
'trailing': false
|
||||
}));
|
||||
|
||||
source.addEventListener('message', <Function>_.debounce(function() {}, 250, {
|
||||
'maxWait': 1000
|
||||
}), false);
|
||||
|
||||
result = <_.LoDashObjectWrapper<Function>>_(function() {}).debounce(150);
|
||||
|
||||
jQuery('#postbox').on('click', <_.LoDashObjectWrapper<Function>>_(function() {}).debounce(300, {
|
||||
'leading': true,
|
||||
'trailing': false
|
||||
}));
|
||||
|
||||
source.addEventListener('message', <_.LoDashObjectWrapper<Function>>_(function() {}).debounce(250, {
|
||||
'maxWait': 1000
|
||||
}), false);
|
||||
|
||||
result = <number>_.defer(function() { console.log('deferred'); });
|
||||
result = <_.LoDashWrapper<number>>_(function() { console.log('deferred'); }).defer();
|
||||
|
||||
var log = _.bind(console.log, console);
|
||||
result = <number>_.delay(log, 1000, 'logged later');
|
||||
result = <_.LoDashWrapper<number>>_(log).delay(1000, 'logged later');
|
||||
|
||||
var fibonacci = <Function>_.memoize(function(n) {
|
||||
return n < 2 ? n : fibonacci(n - 1) + fibonacci(n - 2);
|
||||
});
|
||||
|
||||
var data = {
|
||||
'moe': { 'name': 'moe', 'age': 40 },
|
||||
'curly': { 'name': 'curly', 'age': 60 }
|
||||
};
|
||||
|
||||
var stooge = <Function>_.memoize(function(name: string) { return data[name]; }, _.identity);
|
||||
stooge('curly');
|
||||
|
||||
stooge['cache']['curly'].name = 'jerome';
|
||||
stooge('curly');
|
||||
|
||||
var initialize = <Function>_.once(function(){ });
|
||||
initialize();
|
||||
initialize();
|
||||
|
||||
var greetPartial = function(greeting: string, name: string) { return greeting + ' ' + name; };
|
||||
var hi = <Function>_.partial(greetPartial, 'hi');
|
||||
hi('moe');
|
||||
|
||||
var defaultsDeep = <Function>_.partialRight(_.merge, _.defaults);
|
||||
|
||||
var optionsPartialRight = {
|
||||
'variable': 'data',
|
||||
'imports': { 'jq': $ }
|
||||
};
|
||||
|
||||
defaultsDeep(optionsPartialRight, _.templateSettings);
|
||||
|
||||
var throttled = _.throttle(function () { }, 100);
|
||||
jQuery(window).on('scroll', throttled);
|
||||
|
||||
jQuery('.interactive').on('click', _.throttle(function() { }, 300000, {
|
||||
'trailing': false
|
||||
}));
|
||||
|
||||
var helloWrap = function(name: string) { return 'hello ' + name; };
|
||||
var helloWrap2 = _.wrap(helloWrap, function(func) {
|
||||
return 'before, ' + func('moe') + ', after';
|
||||
});
|
||||
helloWrap2();
|
||||
|
||||
/**********
|
||||
* Objects *
|
||||
***********/
|
||||
result = <any>_.assign({ 'name': 'moe' }, { 'age': 40 });
|
||||
result = <any>_.assign({ 'name': 'moe' }, { 'age': 40 }, function(a: any, b: any) {
|
||||
return typeof a == 'undefined' ? b : a;
|
||||
});
|
||||
|
||||
result = <_.LoDashObjectWrapper<any>>_({ 'name': 'moe' }).assign({ 'age': 40 });
|
||||
result = <_.LoDashObjectWrapper<any>>_({ 'name': 'moe' }).assign({ 'age': 40 }, function(a: any, b: any) {
|
||||
return typeof a == 'undefined' ? b : a;
|
||||
});
|
||||
|
||||
result = <any>_.extend({ 'name': 'moe' }, { 'age': 40 });
|
||||
result = <any>_.extend({ 'name': 'moe' }, { 'age': 40 }, function(a: any, b: any) {
|
||||
return typeof a == 'undefined' ? b : a;
|
||||
});
|
||||
|
||||
result = <_.LoDashObjectWrapper<any>>_({ 'name': 'moe' }).extend({ 'age': 40 });
|
||||
result = <_.LoDashObjectWrapper<any>>_({ 'name': 'moe' }).extend({ 'age': 40 }, function(a: any, b: any) {
|
||||
return typeof a == 'undefined' ? b : a;
|
||||
});
|
||||
|
||||
var result = <any>_.clone(stoogesAges);
|
||||
var result = <any>_.clone(stoogesAges, true);
|
||||
var result = <any>_.clone(stoogesAges, true, function(value) {
|
||||
return _.isElement(value) ? value.cloneNode(false) : undefined;
|
||||
});
|
||||
|
||||
var result = <any>_.cloneDeep(stoogesAges);
|
||||
var result = <any>_.cloneDeep(stoogesAges, function(value) {
|
||||
return _.isElement(value) ? value.cloneNode(false) : undefined;
|
||||
});
|
||||
|
||||
var foodDefaults = { 'name': 'apple' };
|
||||
result = <any>_.defaults(foodDefaults, { 'name': 'banana', 'type': 'fruit' });
|
||||
result = <any>_(foodDefaults).defaults({ 'name': 'banana', 'type': 'fruit' });
|
||||
|
||||
result = <string>_.findKey({ 'a': 1, 'b': 2, 'c': 3, 'd': 4 }, function(num) {
|
||||
return num % 2 == 0;
|
||||
});
|
||||
|
||||
result = <string>_.findLastKey({ 'a': 1, 'b': 2, 'c': 3, 'd': 4 }, function(num) {
|
||||
return num % 2 == 1;
|
||||
});
|
||||
|
||||
result = <any>_.forIn(new Dog('Dagny'), function(value, key) {
|
||||
console.log(key);
|
||||
});
|
||||
|
||||
result = <_.LoDashObjectWrapper<any>>_(new Dog('Dagny')).forIn(function(value, key) {
|
||||
console.log(key);
|
||||
});
|
||||
|
||||
result = <any>_.forInRight(new Dog('Dagny'), function(value, key) {
|
||||
console.log(key);
|
||||
});
|
||||
|
||||
result = <_.LoDashObjectWrapper<any>>_(new Dog('Dagny')).forInRight(function(value, key) {
|
||||
console.log(key);
|
||||
});
|
||||
|
||||
result = <any>_.forOwn({ '0': 'zero', '1': 'one', 'length': 2 }, function(num, key) {
|
||||
console.log(key);
|
||||
});
|
||||
|
||||
result = <_.LoDashObjectWrapper<any>>_({ '0': 'zero', '1': 'one', 'length': 2 }).forOwn(function(num, key) {
|
||||
console.log(key);
|
||||
});
|
||||
|
||||
result = <any>_.forOwnRight({ '0': 'zero', '1': 'one', 'length': 2 }, function(num, key) {
|
||||
console.log(key);
|
||||
});
|
||||
|
||||
result = <_.LoDashObjectWrapper<any>>_({ '0': 'zero', '1': 'one', 'length': 2 }).forOwnRight(function(num, key) {
|
||||
console.log(key);
|
||||
});
|
||||
|
||||
result = <string[]>_.functions(_);
|
||||
result = <string[]>_.methods(_);
|
||||
|
||||
result = <_.LoDashArrayWrapper<string>>_(_).functions();
|
||||
result = <_.LoDashArrayWrapper<string>>_(_).methods();
|
||||
|
||||
result = <boolean>_.has({ 'a': 1, 'b': 2, 'c': 3 }, 'b');
|
||||
|
||||
result = <any>_.invert({ 'first': 'moe', 'second': 'larry' });
|
||||
|
||||
(function(...args: any[]) { return <boolean>_.isArguments(arguments); })(1, 2, 3);
|
||||
|
||||
(function () { return <boolean>_.isArray(arguments); })();
|
||||
result = <boolean>_.isArray([1, 2, 3]);
|
||||
|
||||
result = <boolean>_.isBoolean(null);
|
||||
|
||||
result = <boolean>_.isDate(new Date());
|
||||
|
||||
result = <boolean>_.isElement(document.body);
|
||||
|
||||
result = <boolean>_.isEmpty([1, 2, 3]);
|
||||
result = <boolean>_.isEmpty({});
|
||||
result = <boolean>_.isEmpty('');
|
||||
|
||||
var moe = { 'name': 'moe', 'age': 40 };
|
||||
var copy = { 'name': 'moe', 'age': 40 };
|
||||
|
||||
result = <boolean>_.isEqual(moe, copy);
|
||||
|
||||
var words = ['hello', 'goodbye'];
|
||||
var otherWords = ['hi', 'goodbye'];
|
||||
|
||||
result = <boolean>_.isEqual(words, otherWords, function(a, b) {
|
||||
var reGreet = /^(?:hello|hi)$/i,
|
||||
aGreet = _.isString(a) && reGreet.test(a),
|
||||
bGreet = _.isString(b) && reGreet.test(b);
|
||||
|
||||
return (aGreet || bGreet) ? (aGreet == bGreet) : undefined;
|
||||
});
|
||||
|
||||
result = <boolean>_.isFinite(-101);
|
||||
result = <boolean>_.isFinite('10');
|
||||
result = <boolean>_.isFinite(true);
|
||||
result = <boolean>_.isFinite('');
|
||||
result = <boolean>_.isFinite(Infinity);
|
||||
|
||||
result = <boolean>_.isFunction(_);
|
||||
|
||||
result = <boolean>_.isNaN(NaN);
|
||||
result = <boolean>_.isNaN(new Number(NaN));
|
||||
result = <boolean>_.isNaN(undefined);
|
||||
|
||||
result = <boolean>_.isNull(null);
|
||||
result = <boolean>_.isNull(undefined);
|
||||
|
||||
result = <boolean>_.isNumber(8.4 * 5);
|
||||
|
||||
result = <boolean>_.isObject({});
|
||||
result = <boolean>_.isObject([1, 2, 3]);
|
||||
result = <boolean>_.isObject(1);
|
||||
|
||||
class Stooge {
|
||||
constructor(
|
||||
public name: string,
|
||||
public age: number
|
||||
) {}
|
||||
}
|
||||
|
||||
result = <boolean>_.isPlainObject(new Stooge('moe', 40));
|
||||
result = <boolean>_.isPlainObject([1, 2, 3]);
|
||||
result = <boolean>_.isPlainObject({ 'name': 'moe', 'age': 40 });
|
||||
|
||||
result = <boolean>_.isRegExp(/moe/);
|
||||
|
||||
result = <boolean>_.isString('moe');
|
||||
|
||||
result = <boolean>_.isUndefined(void 0);
|
||||
|
||||
result = <string[]>_.keys({ 'one': 1, 'two': 2, 'three': 3 });
|
||||
|
||||
var mergeNames = {
|
||||
'stooges': [
|
||||
{ 'name': 'moe' },
|
||||
{ 'name': 'larry' }
|
||||
]
|
||||
};
|
||||
|
||||
var mergeAges = {
|
||||
'stooges': [
|
||||
{ 'age': 40 },
|
||||
{ 'age': 50 }
|
||||
]
|
||||
};
|
||||
|
||||
result = <any>_.merge(mergeNames, mergeAges);
|
||||
|
||||
var mergeFood = {
|
||||
'fruits': ['apple'],
|
||||
'vegetables': ['beet']
|
||||
};
|
||||
|
||||
var mergeOtherFood = {
|
||||
'fruits': ['banana'],
|
||||
'vegetables': ['carrot']
|
||||
};
|
||||
|
||||
result = <any>_.merge(mergeFood, mergeOtherFood, function(a: any, b: any) {
|
||||
return _.isArray(a) ? a.concat(b) : undefined;
|
||||
});
|
||||
|
||||
result = <any>_.omit({ 'name': 'moe', 'age': 40 }, 'age');
|
||||
result = <any>_.omit({ 'name': 'moe', 'age': 40 }, ['age']);
|
||||
result = <any>_.omit({ 'name': 'moe', 'age': 40 }, function(value) {
|
||||
return typeof value == 'number';
|
||||
});
|
||||
|
||||
result = <any[][]>_.pairs({ 'moe': 30, 'larry': 40 });
|
||||
|
||||
result = <any>_.pick({ 'name': 'moe', '_userid': 'moe1' }, 'name');
|
||||
result = <any>_.pick({ 'name': 'moe', '_userid': 'moe1' }, ['name']);
|
||||
result = <any>_.pick({ 'name': 'moe', '_userid': 'moe1' }, function(value, key) {
|
||||
return key.charAt(0) != '_';
|
||||
});
|
||||
|
||||
result = <any>_.transform([1, 2, 3, 4, 5, 6, 7, 8, 9, 10], function(r: any, num: number) {
|
||||
num *= num;
|
||||
if (num % 2) {
|
||||
return r.push(num) < 3;
|
||||
}
|
||||
});
|
||||
// → [1, 9, 25]
|
||||
|
||||
result = <any>_.transform({ 'a': 1, 'b': 2, 'c': 3 }, function(r: any, num: number, key: string) {
|
||||
r[key] = num * 3;
|
||||
});
|
||||
|
||||
result = <any[]>_.values({ 'one': 1, 'two': 2, 'three': 3 });
|
||||
|
||||
/**********
|
||||
* Utilities *
|
||||
***********/
|
||||
|
||||
result = <string>_.escape('Moe, Larry & Curly');
|
||||
|
||||
result = <{ name: string }>_.identity({ 'name': 'moe' });
|
||||
|
||||
_.mixin({
|
||||
'capitalize': function(string) {
|
||||
return string.charAt(0).toUpperCase() + string.slice(1).toLowerCase();
|
||||
}
|
||||
});
|
||||
|
||||
var lodash = <typeof _>_.noConflict();
|
||||
|
||||
result = <number>_.parseInt('08');
|
||||
|
||||
result = <number>_.random(0, 5);
|
||||
result = <number>_.random(5);
|
||||
result = <number>_.random(5, true);
|
||||
result = <number>_.random(1.2, 5.2);
|
||||
result = <number>_.random(0, 5, true);
|
||||
|
||||
var object = {
|
||||
'cheese': 'crumpets',
|
||||
'stuff': function() {
|
||||
return 'nonsense';
|
||||
}
|
||||
};
|
||||
|
||||
result = <any>_.result(object, 'cheese');
|
||||
result = <any>_.result(object, 'stuff');
|
||||
|
||||
var tempObject = {};
|
||||
result = <typeof _>_.runInContext(tempObject);
|
||||
|
||||
result = <_.TemplateExecutor>_.template('hello <%= name %>');
|
||||
result = <string>_.template('<b><%- value %></b>', { 'value': '<script>' });
|
||||
|
||||
var listTemplate = '<% _.forEach(people, function(name) { %><li><%- name %></li><% }); %>';
|
||||
result = <string>_.template(listTemplate, { 'people': ['moe', 'larry'] });
|
||||
result = <string>_.template('hello ${ name }', { 'name': 'curly' });
|
||||
result = <string>_.template('<% print("hello " + name); %>!', { 'name': 'larry' });
|
||||
|
||||
var listTemplate = '<% $.each(people, function(name) { %><li><%- name %></li><% }); %>';
|
||||
result = <string>_.template(listTemplate, { 'people': ['moe', 'larry'] }, { 'imports': { '$': jQuery } });
|
||||
result = <_.TemplateExecutor>_.template('hello <%= name %>', null, { 'sourceURL': '/basic/greeting.jst' });
|
||||
|
||||
result = <_.TemplateExecutor>_.template('hi <%= data.name %>!', null, { 'variable': 'data' });
|
||||
result = <string>(<_.TemplateExecutor>result).source;
|
||||
|
||||
class Mage {
|
||||
public castSpell(n: number) {
|
||||
return n;
|
||||
}
|
||||
|
||||
public cast(n: number) {
|
||||
return n;
|
||||
}
|
||||
}
|
||||
|
||||
var mage = new Mage();
|
||||
result = <any[]>_.times(3, _.partial(_.random, 1, 6));
|
||||
result = <any[]>_.times(3, function(n: number) { mage.castSpell(n); });
|
||||
result = <any[]>_.times(3, function(n: number) { this.cast(n); }, mage);
|
||||
|
||||
result = <string>_.unescape('Moe, Larry & Curly');
|
||||
|
||||
result = <string>_.uniqueId('contact_');
|
||||
result = <string>_.uniqueId();
|
||||
|
||||
/**********
|
||||
* Utilities *
|
||||
***********/
|
||||
|
||||
result = <string>_.VERSION;
|
||||
result = <_.Support>_.support;
|
||||
result = <_.TemplateSettings>_.templateSettings;
|
||||
Vendored
+4045
File diff suppressed because it is too large
Load Diff
Vendored
+1
-1
@@ -8,7 +8,7 @@ interface Mocha {
|
||||
setup(options: MochaSetupOptions): Mocha;
|
||||
|
||||
//Run tests and invoke `fn()` when complete.
|
||||
run(callback: () => void): void;
|
||||
run(callback?: () => void): void;
|
||||
|
||||
// Set reporter as function
|
||||
reporter(reporter: () => void): Mocha;
|
||||
|
||||
@@ -47,4 +47,8 @@ $(function () {
|
||||
|
||||
var elem;
|
||||
Modernizr.hasEvent('gesturestart', elem);
|
||||
|
||||
if (!Modernizr.autofocus) {
|
||||
$("[autofocus]").focus();
|
||||
}
|
||||
});
|
||||
|
||||
Vendored
+8
-7
@@ -47,6 +47,7 @@ interface InputTypesboolean {
|
||||
}
|
||||
|
||||
interface ModernizrStatic {
|
||||
autofocus: boolean;
|
||||
fontface: boolean;
|
||||
backgroundsize: boolean;
|
||||
borderimage: boolean;
|
||||
@@ -91,9 +92,9 @@ interface ModernizrStatic {
|
||||
touch: boolean;
|
||||
webgl: boolean;
|
||||
|
||||
load(resources: Array);
|
||||
load(resourceObject: any);
|
||||
load(resourceString: string);
|
||||
load(resources: Array): void;
|
||||
load(resourceObject: any): void;
|
||||
load(resourceString: string): void;
|
||||
|
||||
prefixed(): boolean;
|
||||
prefixed(property: string): boolean;
|
||||
@@ -101,11 +102,11 @@ interface ModernizrStatic {
|
||||
|
||||
mq(mediaQuery: string): boolean;
|
||||
|
||||
addTest(feature: string, test: () => any);
|
||||
addTest(feature: string, test: boolean);
|
||||
addTest(feature: any);
|
||||
addTest(feature: string, test: () => any): void;
|
||||
addTest(feature: string, test: boolean): void;
|
||||
addTest(feature: any): void;
|
||||
|
||||
testStyles(rule: string, callback: (element, rule) => void, nodes?: number, testnames?: string[]): boolean;
|
||||
testStyles(rule: string, callback: (element: HTMLDivElement, rule: string) => void, nodes?: number, testnames?: string[]): boolean;
|
||||
testProp(property: string): boolean;
|
||||
testAllProps(property: string, prefix?: string): boolean;
|
||||
testAllProps(property: string, obj: any, element: any): boolean;
|
||||
|
||||
Vendored
+1
-1
@@ -156,7 +156,7 @@ interface NodeBuffer {
|
||||
write(string: string, offset?: number, length?: number, encoding?: string): number;
|
||||
toString(encoding?: string, start?: number, end?: number): string;
|
||||
length: number;
|
||||
copy(targetBuffer: NodeBuffer, targetStart?: number, sourceStart?: number, sourceEnd?: number): void;
|
||||
copy(targetBuffer: NodeBuffer, targetStart?: number, sourceStart?: number, sourceEnd?: number): number;
|
||||
slice(start?: number, end?: number): NodeBuffer;
|
||||
readUInt8(offset: number, noAsset?: boolean): number;
|
||||
readUInt16LE(offset: number, noAssert?: boolean): number;
|
||||
|
||||
Vendored
+1
-1
@@ -161,7 +161,7 @@ interface NodeBuffer {
|
||||
write(string: string, offset?: number, length?: number, encoding?: string): number;
|
||||
toString(encoding?: string, start?: number, end?: number): string;
|
||||
length: number;
|
||||
copy(targetBuffer: NodeBuffer, targetStart?: number, sourceStart?: number, sourceEnd?: number): void;
|
||||
copy(targetBuffer: NodeBuffer, targetStart?: number, sourceStart?: number, sourceEnd?: number): number;
|
||||
slice(start?: number, end?: number): NodeBuffer;
|
||||
readUInt8(offset: number, noAsset?: boolean): number;
|
||||
readUInt16LE(offset: number, noAssert?: boolean): number;
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
///<reference path="./NProgress.d.ts"/>
|
||||
|
||||
function test_basics() {
|
||||
NProgress.start();
|
||||
NProgress.inc();
|
||||
NProgress.done();
|
||||
NProgress.set(0.5);
|
||||
|
||||
var status = NProgress.status;
|
||||
var version = NProgress.version;
|
||||
}
|
||||
|
||||
function test_configuration() {
|
||||
NProgress.configure({
|
||||
speed: 0.3
|
||||
});
|
||||
|
||||
NProgress.configure({
|
||||
trickle: false
|
||||
});
|
||||
|
||||
NProgress.configure({
|
||||
ease: 'ease',
|
||||
minimum: 0.09,
|
||||
showSpinner: false,
|
||||
speed: 420,
|
||||
template: "<div>blah</div>",
|
||||
trickle: false,
|
||||
trickleRate: 0.42,
|
||||
trickleSpeed: 42
|
||||
});
|
||||
}
|
||||
Vendored
+105
@@ -0,0 +1,105 @@
|
||||
// Type definitions for NProgress
|
||||
// Project: https://github.com/rstacruz/nprogress
|
||||
// Definitions by: Judah Gabriel Himango <http://debuggerdotbreak.wordpress.com>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
interface NProgressStatic {
|
||||
/**
|
||||
* Shows the progress bar and begins trickling progress.
|
||||
* @returns {NProgressConfigureOptions} The current NProgress object, useful for chaining.
|
||||
*/
|
||||
start(): NProgressStatic;
|
||||
|
||||
/**
|
||||
* Finishes loading by transitioning it to 100%, then fading out.
|
||||
* @param {boolean} forceShow Forces the progress bar to show, even if it's not being shown. (The default behavior is that .done() will not do anything if .start() isn't called.)
|
||||
* @returns {NProgressConfigureOptions} The current NProgress object, useful for chaining.
|
||||
*/
|
||||
done(forceShow?: boolean): NProgressStatic;
|
||||
|
||||
/**
|
||||
* Increments the progress bar with a random amount. This will never get to 100%: use it for every image load (or similar).
|
||||
* @returns {NProgressConfigureOptions} The current NProgress object, useful for chaining.
|
||||
*/
|
||||
inc(): NProgressStatic;
|
||||
|
||||
/**
|
||||
* Removes the progress indicator.
|
||||
*/
|
||||
remove(): void;
|
||||
|
||||
/**
|
||||
* Sets the progress percentage.
|
||||
* @param {number} progressPercent A number between 0.0 and 1.0 that represents the progress percentage.
|
||||
* @returns {NProgressConfigureOptions} The current NProgress object, useful for chaining.
|
||||
*/
|
||||
set(progressPercent: number): NProgressStatic;
|
||||
|
||||
/**
|
||||
* Configures the progress indicator.
|
||||
* @param {NProgressConfigureOptions} options An object containing the configuration options.
|
||||
* @returns {NProgressConfigureOptions} The current NProgress object, useful for chaining.
|
||||
*/
|
||||
configure(options: NProgressConfigureOptions): NProgressStatic;
|
||||
|
||||
/**
|
||||
* Gets the NProgress version.
|
||||
*/
|
||||
version: string;
|
||||
|
||||
/**
|
||||
* Gets the status. If started, it will be the last progress number set.
|
||||
*/
|
||||
status: any;
|
||||
|
||||
/**
|
||||
* Gets whether progress has been started.
|
||||
* @returns {boolean} Whether the progress has started.
|
||||
*/
|
||||
isStarted(): boolean;
|
||||
}
|
||||
|
||||
interface NProgressConfigureOptions {
|
||||
|
||||
/**
|
||||
* The minimum progress percentage. Default is 0.08.
|
||||
*/
|
||||
minimum?: number;
|
||||
|
||||
/**
|
||||
* How much to increase per trickle. Example: .02. Default is true.
|
||||
*/
|
||||
trickleRate?: number;
|
||||
|
||||
/**
|
||||
* How often to trickle, in milliseconds. Default is 800.
|
||||
*/
|
||||
trickleSpeed?: number;
|
||||
|
||||
/**
|
||||
* Whether to show the spinner. Defaults to true. Default is true.
|
||||
*/
|
||||
showSpinner?: boolean;
|
||||
|
||||
/**
|
||||
* Whether to enable trickling the progress. Default is true.
|
||||
*/
|
||||
trickle?: boolean;
|
||||
|
||||
/**
|
||||
* The CSS easing animation to use. Default is 'ease'.
|
||||
*/
|
||||
ease?: string;
|
||||
|
||||
/**
|
||||
* The animation speed in milliseconds. Default is 200.
|
||||
*/
|
||||
speed?: number;
|
||||
|
||||
/**
|
||||
* The HTML markup inserted for the progress indicator. To keep the progress bar working, keep an element with role='bar' in there.
|
||||
*/
|
||||
template?: string;
|
||||
}
|
||||
|
||||
declare var NProgress: NProgressStatic;
|
||||
Vendored
+4856
File diff suppressed because it is too large
Load Diff
Vendored
+8
-2
@@ -134,11 +134,17 @@ interface Config {
|
||||
current: Object;
|
||||
reorder: boolean;
|
||||
requireExpects: boolean;
|
||||
testTimeout: number;
|
||||
urlConfig: Array;
|
||||
testTimeout: number;
|
||||
urlConfig: Array<URLConfigItem>;
|
||||
done: any;
|
||||
}
|
||||
|
||||
interface URLConfigItem {
|
||||
id: string;
|
||||
label: string;
|
||||
tooltip: string;
|
||||
}
|
||||
|
||||
interface LifecycleObject {
|
||||
/**
|
||||
* Runs before each test
|
||||
|
||||
Vendored
+1
-1
@@ -47,7 +47,7 @@ interface Select2Options {
|
||||
closeOnSelect?: boolean;
|
||||
openOnEnter?: boolean;
|
||||
id?: (object: any) => string;
|
||||
matcher?: (term: string, text: string, option: JQuery) => boolean;
|
||||
matcher?: (term: string, text: string, option: any) => boolean;
|
||||
formatSelection?: (object: any, container: JQuery) => string;
|
||||
formatResult?: (object: any, container: JQuery, query: any) => string;
|
||||
formatResultCssClass?: (object: any) => string;
|
||||
|
||||
Vendored
+3
-3
@@ -4397,9 +4397,9 @@ interface Date {
|
||||
* }); -> ex. 1 day ago
|
||||
**/
|
||||
format(format: string, locale?: string): string;
|
||||
short(): string;
|
||||
long(): string;
|
||||
full(): string;
|
||||
short(locale?: string): string;
|
||||
long(locale?: string): string;
|
||||
full(locale?: string): string;
|
||||
|
||||
/**
|
||||
* Returns a string representation of the offset from UTC time. If [iso]
|
||||
|
||||
Reference in New Issue
Block a user