mirror of
https://github.com/wassname/DefinitelyTyped.git
synced 2026-09-09 11:13:57 +08:00
@@ -0,0 +1,49 @@
|
||||
/// <reference path="Q.d.ts" />
|
||||
|
||||
var delay = function (delay) {
|
||||
var d = Q.defer();
|
||||
setTimeout(d.resolve, delay);
|
||||
return d.promise;
|
||||
};
|
||||
|
||||
Q.when(delay(1000), function () {
|
||||
console.log('Hello, World!');
|
||||
});
|
||||
|
||||
var eventually = function (eventually) {
|
||||
return Q.delay(eventually, 1000);
|
||||
};
|
||||
|
||||
var x = Q.all([1, 2, 3].map(eventually));
|
||||
Q.when(x, function (x) {
|
||||
console.log(x);
|
||||
});
|
||||
|
||||
Q.all([
|
||||
eventually(10),
|
||||
eventually(20)
|
||||
])
|
||||
.spread(function (x, y) {
|
||||
console.log(x, y);
|
||||
});
|
||||
|
||||
Q.fcall(function () { })
|
||||
.then(function () { })
|
||||
.then(function () { })
|
||||
.then(function () { })
|
||||
.then(function (value4) {
|
||||
// Do something with value4
|
||||
}, function (error) {
|
||||
// Handle any error from step1 through step4
|
||||
}).done();
|
||||
|
||||
Q.allResolved([])
|
||||
.then(function (promises: Qpromise[]) {
|
||||
promises.forEach(function (promise) {
|
||||
if (promise.isFulfilled()) {
|
||||
var value = promise.valueOf();
|
||||
} else {
|
||||
var exception = promise.valueOf().exception;
|
||||
}
|
||||
})
|
||||
});
|
||||
@@ -8,16 +8,17 @@ interface Qdeferred {
|
||||
resolve(value: any): any;
|
||||
reject(reason: any);
|
||||
notify(value: any);
|
||||
makeNodeResolver();
|
||||
makeNodeResolver(): Function;
|
||||
}
|
||||
|
||||
interface Qpromise {
|
||||
fail(errorCallback: Function): Qpromise;
|
||||
fin(finallyCallback: Function): Qpromise;
|
||||
then(onFulfilled: Function, onRejected?: Function, onProgress?: Function): Qpromise;
|
||||
spread(onFulfilled: Function, onRejected?: Function): Qpromise;
|
||||
catch(onRejected: Function): Qpromise;
|
||||
progress(onProgress: Function): Qpromise;
|
||||
done(onFulfilled: Function, onRejected?: Function, onProgress?: Function): Qpromise;
|
||||
done(onFulfilled?: Function, onRejected?: Function, onProgress?: Function): Qpromise;
|
||||
get (propertyName: String): Qpromise;
|
||||
set (propertyName: String, value: any): Qpromise;
|
||||
delete (propertyName: String): Qpromise;
|
||||
@@ -35,6 +36,7 @@ interface Qpromise {
|
||||
}
|
||||
|
||||
interface QStatic {
|
||||
when(value: any, onFulfilled: Function, onRejected?: Function): Qpromise;
|
||||
try(method: Function, ...args: any[]): Qpromise;
|
||||
fbind(method: Function, ...args: any[]): Qpromise;
|
||||
fcall(method: Function, ...args: any[]): Qpromise;
|
||||
|
||||
@@ -0,0 +1,75 @@
|
||||
/// <reference path="q.module.d.ts" />
|
||||
/// <reference path="../jasmine/jasmine.d.ts" />
|
||||
|
||||
import Q = module("q");
|
||||
|
||||
describe("q", function () {
|
||||
it("should return", function (done) {
|
||||
Q({ myValue: true }).then(function (obj) {
|
||||
|
||||
if (obj.myValue) done();
|
||||
else done("didn't work =(");
|
||||
},
|
||||
(err) => done(err));
|
||||
});
|
||||
|
||||
it("should process all", function (done: (err?) => void ) {
|
||||
Q.all([Q(1), Q(2), Q(3)]).then(function (arr: number[]) {
|
||||
var sum = arr.reduce(function (memo, cur) {
|
||||
return memo + cur;
|
||||
}, 0);
|
||||
|
||||
if (sum === 6) done();
|
||||
else done({ actual: sum });
|
||||
},
|
||||
(err) => done(err));
|
||||
});
|
||||
});
|
||||
|
||||
var delay = function (delay) {
|
||||
var d = Q.defer();
|
||||
setTimeout(d.resolve, delay);
|
||||
return d.promise;
|
||||
};
|
||||
|
||||
Q.when(delay(1000), function () {
|
||||
console.log('Hello, World!');
|
||||
});
|
||||
|
||||
var eventually = function (eventually) {
|
||||
return Q.delay(eventually, 1000);
|
||||
};
|
||||
|
||||
var x = Q.all([1, 2, 3].map(eventually));
|
||||
Q.when(x, function (x) {
|
||||
console.log(x);
|
||||
});
|
||||
|
||||
Q.all([
|
||||
eventually(10),
|
||||
eventually(20)
|
||||
])
|
||||
.spread(function (x, y) {
|
||||
console.log(x, y);
|
||||
});
|
||||
|
||||
Q.fcall(function () { })
|
||||
.then(function () { })
|
||||
.then(function () { })
|
||||
.then(function () { })
|
||||
.then(function (value4) {
|
||||
// Do something with value4
|
||||
}, function (error) {
|
||||
// Handle any error from step1 through step4
|
||||
}).done();
|
||||
|
||||
Q.allResolved([])
|
||||
.then(function (promises: Qpromise[]) {
|
||||
promises.forEach(function (promise) {
|
||||
if (promise.isFulfilled()) {
|
||||
var value = promise.valueOf();
|
||||
} else {
|
||||
var exception = promise.valueOf().exception;
|
||||
}
|
||||
})
|
||||
});
|
||||
Vendored
+27
@@ -0,0 +1,27 @@
|
||||
/// <reference path="Q.d.ts" />
|
||||
|
||||
module "q" {
|
||||
export function when(value: any, onFulfilled: Function, onRejected?: Function): Qpromise;
|
||||
export function try(method: Function, ...args: any[]): Qpromise;
|
||||
export function fbind(method: Function, ...args: any[]): Qpromise;
|
||||
export function fcall(method: Function, ...args: any[]): Qpromise;
|
||||
export function all(promises: Qpromise[]): Qpromise;
|
||||
export function allResolved(promises: Qpromise[]): Qpromise;
|
||||
export function spread(onFulfilled: Function, onRejected: Function): Qpromise;
|
||||
export function timeout(ms: number): Qpromise;
|
||||
export function delay(ms: number): Qpromise;
|
||||
export function delay(value: any, ms: number): Qpromise;
|
||||
export function isFulfilled(): bool;
|
||||
export function isRejected(): bool;
|
||||
export function isPending(): bool;
|
||||
export function valueOf(): any;
|
||||
export function defer(): Qdeferred;
|
||||
export function (value: any): Qpromise;
|
||||
export function reject(): Qpromise;
|
||||
export function promise(factory: { resolve: Function; reject: Function; notify: Function; }): Qpromise;
|
||||
export function isPromise(value: any): bool;
|
||||
export function async(generatorFunction: any): Qdeferred;
|
||||
export function nextTick(callback: Function);
|
||||
export var oneerror: any;
|
||||
export var longStackJumpLimit: number;
|
||||
}
|
||||
@@ -41,9 +41,10 @@ List of Definitions
|
||||
* [Chosen](http://harvesthq.github.com/chosen/) (by [Boris Yankov](https://github.com/borisyankov))
|
||||
* [Chrome](http://developer.chrome.com/extensions/) (by [Matthew Kimber](https://github.com/matthewkimber))
|
||||
* [CodeMirror](http://codemirror.net) (by [Fran�ois de Campredon](https://github.com/fdecampredon))
|
||||
* [Commander](http://github.com/visionmedia/commander.js) (by [Marcelo Dezem](https://github.com/mdezem))
|
||||
* [d3.js](http://d3js.org/) (from TypeScript samples)
|
||||
* [domo](http://domo-js.com/) (by [Steve Fenton](https://github.com/Steve-Fenton))
|
||||
* [dust](http://linkedin.github.com/dustjs) (by [Marcelo Dezem](https://github.com/mdezem)
|
||||
* [dust](http://linkedin.github.com/dustjs) (by [Marcelo Dezem](https://github.com/mdezem))
|
||||
* [EaselJS](http://www.createjs.com/#!/EaselJS) (by [Pedro Ferreira](https://bitbucket.org/drk4))
|
||||
* [ember.js](http://emberjs.com/) (by [Boris Yankov](https://github.com/borisyankov))
|
||||
* [EpicEditor](http://epiceditor.com/) (by [Boris Yankov](https://github.com/borisyankov))
|
||||
@@ -55,9 +56,11 @@ List of Definitions
|
||||
* [Finite State Machine](https://github.com/jakesgordon/javascript-state-machine) (by [Boris Yankov](https://github.com/borisyankov))
|
||||
* [FlexSlider](http://www.woothemes.com/flexslider/) (by [Diullei Gomes](https://github.com/Diullei))
|
||||
* [Foundation](http://foundation.zurb.com/) (by [Boris Yankov](https://github.com/borisyankov))
|
||||
* [Gamepad](http://www.w3.org/TR/gamepad/) (by [Kon](http://phyzkit.net/))
|
||||
* [glDatePicker](http://glad.github.com/glDatePicker/) (by [D�niel Tar](https://github.com/qcz))
|
||||
* [GreenSock Animation Platform (GSAP)](http://www.greensock.com/get-started-js/) (by [Robert S.](https://github.com/codeBelt))
|
||||
* [GoogleMaps](https://developers.google.com/maps/) (by [Esben Nepper](https://github.com/eNepper))
|
||||
* [Google Geolocation](https://code.google.com/p/geo-location-javascript/) (by [Vincent Bortone](https://github.com/vbortone))
|
||||
* [Hammer.js](http://eightmedia.github.com/hammer.js/) (by [Boris Yankov](https://github.com/borisyankov))
|
||||
* [Handlebars](http://handlebarsjs.com/) (by [Boris Yankov](https://github.com/borisyankov))
|
||||
* [Highcharts](http://www.highcharts.com/) (by [damianog](https://github.com/damianog))
|
||||
@@ -89,6 +92,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))
|
||||
* [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/))
|
||||
* [KeyboardJS](https://github.com/RobertWHurst/KeyboardJS) (by [Vincent Bortone](https://github.com/vbortone/))
|
||||
* [Knockback](http://kmalakoff.github.com/knockback/) (by [Marcel Binot](https://github.com/docgit))
|
||||
@@ -102,6 +106,7 @@ List of Definitions
|
||||
* [Leaflet](https://github.com/Leaflet/Leaflet) (by [Vladimir](https://github.com/rgripper))
|
||||
* [Libxmljs](https://github.com/polotek/libxmljs) (by [François de Campredon](https://github.com/fdecampredon))
|
||||
* [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))
|
||||
* [Marked](https://github.com/chjj/marked) (by [William Orr](https://github.com/worr))
|
||||
* [Modernizr](http://modernizr.com/) (by [Boris Yankov](https://github.com/borisyankov))
|
||||
* [Moment.js](https://github.com/timrwood/moment) (by [Michael Lakerveld](https://github.com/Lakerfield))
|
||||
@@ -129,18 +134,21 @@ List of Definitions
|
||||
* [SockJS](https://github.com/sockjs/sockjs-client) (by [Emil Ivanov](https://github.com/vladev))
|
||||
* [SoundJS](http://www.createjs.com/#!/SoundJS) (by [Pedro Ferreira](https://bitbucket.org/drk4))
|
||||
* [Spin](http://fgnass.github.com/spin.js/) (by [Boris Yankov](https://github.com/borisyankov))
|
||||
* [Store.js](https://github.com/marcuswestin/store.js/) (by [Vincent Bortone](https://github.com/vbortone/))
|
||||
* [Store.js](https://github.com/marcuswestin/store.js/) (by [Vincent Bortone](https://github.com/vbortone))
|
||||
* [Sugar](http://sugarjs.com/) (by [Josh Baldwin](https://github.com/jbaldwin/))
|
||||
* [SwipeView](http://cubiq.org/swipeview) (by [Boris Yankov](https://github.com/borisyankov))
|
||||
* [Tags Manager](http://welldonethings.com/tags/manager) (by [Vincent Bortone](https://github.com/vbortone))
|
||||
* [Teechart](http://www.steema.com) (by [Steema](http://www.steema.com))
|
||||
* [three.js](http://mrdoob.github.com/three.js/) (by [Kon](http://phyzkit.net/))
|
||||
* [Toastr](https://github.com/CodeSeven/toastr) (by [Boris Yankov](https://github.com/borisyankov))
|
||||
* [trunk8](https://github.com/rviscomi/trunk8) (by [Blake Niemyjski](https://github.com/niemyjski))
|
||||
* [TweenJS](http://www.createjs.com/#!/TweenJS) (by [Pedro Ferreira](https://bitbucket.org/drk4))
|
||||
* [tween.js](https://github.com/sole/tween.js/) (by [Adam R. Smith](https://github.com/sunetos))
|
||||
* [twitter-bootstrap-wizard](https://github.com/VinceG/twitter-bootstrap-wizard) (by [Blake Niemyjski](https://github.com/niemyjski))
|
||||
* [Ubuntu Unity Web API](https://launchpad.net/libunity-webapps) (by [John Vrbanac](https://github.com/jmvrbanac))
|
||||
* [Underscore.js](http://underscorejs.org/) (by [Boris Yankov](https://github.com/borisyankov))
|
||||
* [Underscore.js (Typed)](http://underscorejs.org/) (by [Josh Baldwin](https://github.com/jbaldwin/))
|
||||
* [Underscore-ko.js](https://github.com/kamranayub/UnderscoreKO) (by [Maurits Elbers](https://github.com/MagicMau))
|
||||
* [Viewporter](https://github.com/zynga/viewporter) (by [Boris Yankov](https://github.com/borisyankov))
|
||||
* [Vimeo](http://developer.vimeo.com/player/js-api) (by [Daz Wilkin](https://github.com/DazWilkin/))
|
||||
* [WebRTC](http://dev.w3.org/2011/webrtc/editor/webrtc.html) (by [Ken Smith](https://github.com/smithkl42))
|
||||
@@ -151,13 +159,11 @@ List of Definitions
|
||||
Requested Definitions
|
||||
---------------------
|
||||
* [Rickshaw](https://github.com/shutterstock/rickshaw)
|
||||
* [Livestamp.js](https://github.com/mattbradley/livestampjs)
|
||||
* [jQuery ScrollTo](https://github.com/balupton/jquery-scrollto)
|
||||
* [Crossfilter](https://github.com/square/crossfilter)
|
||||
* [dc.js](https://github.com/NickQiZhu/dc.js)
|
||||
* [google.visualizations](https://developers.google.com/chart/)
|
||||
* [Tags Manager](http://welldonethings.com/tags/manager)
|
||||
* [Prelude.ls](http://gkz.github.com/prelude-ls/)
|
||||
* [MooTools](http://mootools.net/)
|
||||
* [Lo-Dash](http://lodash.com/)
|
||||
* [Google geolocation](https://code.google.com/p/geo-location-javascript/)
|
||||
* [java](https://github.com/nearinfinity/node-java)
|
||||
|
||||
Vendored
+2
-2
@@ -24,7 +24,7 @@ module ng {
|
||||
debug(obj: any): string;
|
||||
|
||||
// see http://docs.angularjs.org/api/angular.mock.inject
|
||||
inject(...fns: Function[]): void;
|
||||
inject(...fns: Function[]): any;
|
||||
|
||||
// see http://docs.angularjs.org/api/angular.mock.module
|
||||
module(...modules: any[]): any;
|
||||
@@ -71,7 +71,7 @@ module ng {
|
||||
// see http://docs.angularjs.org/api/ngMock.$httpBackend
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
interface IHttpBackendService {
|
||||
flush(count: number): void;
|
||||
flush(count?: number): void;
|
||||
resetExpectations(): void;
|
||||
verifyNoOutstandingExpectation(): void;
|
||||
verifyNoOutstandingRequest(): void;
|
||||
|
||||
@@ -0,0 +1,140 @@
|
||||
/// <reference path="angular.d.ts" />
|
||||
|
||||
// issue: https://github.com/borisyankov/DefinitelyTyped/issues/369
|
||||
https://github.com/witoldsz/angular-http-auth/blob/master/src/angular-http-auth.js
|
||||
/**
|
||||
* @license HTTP Auth Interceptor Module for AngularJS
|
||||
* (c) 2012 Witold Szczerba
|
||||
* License: MIT
|
||||
*/
|
||||
angular.module('http-auth-interceptor', [])
|
||||
|
||||
.provider('authService', function () {
|
||||
/**
|
||||
* Holds all the requests which failed due to 401 response,
|
||||
* so they can be re-requested in future, once login is completed.
|
||||
*/
|
||||
var buffer = [];
|
||||
|
||||
/**
|
||||
* Required by HTTP interceptor.
|
||||
* Function is attached to provider to be invisible for regular users of this service.
|
||||
*/
|
||||
this.pushToBuffer = function (config: ng.IRequestConfig, deferred: ng.IDeferred) {
|
||||
buffer.push({
|
||||
config: config,
|
||||
deferred: deferred
|
||||
});
|
||||
}
|
||||
|
||||
this.$get = ['$rootScope', '$injector', <any>function ($rootScope: ng.IScope, $injector: ng.auto.IInjectorService) {
|
||||
var $http: ng.IHttpService; //initialized later because of circular dependency problem
|
||||
function retry(config: ng.IRequestConfig, deferred: ng.IDeferred) {
|
||||
$http = $http || $injector.get('$http');
|
||||
$http(config).then(function (response) {
|
||||
deferred.resolve(response);
|
||||
});
|
||||
}
|
||||
function retryAll() {
|
||||
for (var i = 0; i < buffer.length; ++i) {
|
||||
retry(buffer[i].config, buffer[i].deferred);
|
||||
}
|
||||
buffer = [];
|
||||
}
|
||||
|
||||
return {
|
||||
loginConfirmed: function () {
|
||||
$rootScope.$broadcast('event:auth-loginConfirmed');
|
||||
retryAll();
|
||||
}
|
||||
}
|
||||
}]
|
||||
})
|
||||
|
||||
/**
|
||||
* $http interceptor.
|
||||
* On 401 response - it stores the request and broadcasts 'event:angular-auth-loginRequired'.
|
||||
*/
|
||||
.config(['$httpProvider', 'authServiceProvider', <any>function ($httpProvider: ng.IHttpProvider, authServiceProvider) {
|
||||
|
||||
var interceptor = ['$rootScope', '$q', <any>function ($rootScope: ng.IScope, $q: ng.IQService) {
|
||||
function success(response: ng.IHttpPromiseCallbackArg) {
|
||||
return response;
|
||||
}
|
||||
|
||||
function error(response: ng.IHttpPromiseCallbackArg) {
|
||||
if (response.status === 401) {
|
||||
var deferred = $q.defer();
|
||||
authServiceProvider.pushToBuffer(response.config, deferred);
|
||||
$rootScope.$broadcast('event:auth-loginRequired');
|
||||
return deferred.promise;
|
||||
}
|
||||
// otherwise
|
||||
return $q.reject(response);
|
||||
}
|
||||
|
||||
return function (promise: ng.IHttpPromise) {
|
||||
return promise.then(success, error);
|
||||
}
|
||||
|
||||
}];
|
||||
$httpProvider.responseInterceptors.push(interceptor);
|
||||
}]);
|
||||
|
||||
|
||||
module HttpAndRegularPromiseTests {
|
||||
interface Person {
|
||||
firstName: string;
|
||||
lastName: string;
|
||||
}
|
||||
|
||||
interface ExpectedResponse extends Person {}
|
||||
|
||||
interface SomeControllerScope extends ng.IScope {
|
||||
person: Person;
|
||||
theAnswer: number;
|
||||
letters: string[];
|
||||
}
|
||||
|
||||
interface OurApiPromiseCallbackArg extends ng.IHttpPromiseCallbackArg {
|
||||
data?: ExpectedResponse;
|
||||
}
|
||||
|
||||
var someController: Function = ($scope: SomeControllerScope, $http: ng.IHttpService, $q: ng.IQService) => {
|
||||
$http.get("http://somewhere/some/resource")
|
||||
.success((data: ExpectedResponse) => {
|
||||
$scope.person = data;
|
||||
});
|
||||
|
||||
$http.get("http://somewhere/some/resource")
|
||||
.then((response: ng.IHttpPromiseCallbackArg) => {
|
||||
// typing lost, so something like
|
||||
// var i: number = response.data
|
||||
// would type check
|
||||
$scope.person = response.data;
|
||||
});
|
||||
|
||||
$http.get("http://somewhere/some/resource")
|
||||
.then((response: OurApiPromiseCallbackArg) => {
|
||||
// typing lost, so something like
|
||||
// var i: number = response.data
|
||||
// would NOT type check
|
||||
$scope.person = response.data;
|
||||
});
|
||||
|
||||
var aPromise: ng.IPromise = $q.when({firstName: "Jack", lastName: "Sparrow"});
|
||||
aPromise.then((person: Person) => {
|
||||
$scope.person = person;
|
||||
});
|
||||
|
||||
var bPromise: ng.IPromise = $q.when(42);
|
||||
bPromise.then((answer: number) => {
|
||||
$scope.theAnswer = answer;
|
||||
});
|
||||
|
||||
var cPromise: ng.IPromise = $q.when(["a", "b", "c"]);
|
||||
cPromise.then((letters: string[]) => {
|
||||
$scope.letters = letters;
|
||||
});
|
||||
}
|
||||
}
|
||||
Vendored
+44
-36
@@ -45,16 +45,16 @@ module ng {
|
||||
isString(value: any): bool;
|
||||
isUndefined(value: any): bool;
|
||||
lowercase(str: string): string;
|
||||
/** construct your angular application
|
||||
/** construct your angular application
|
||||
official docs: Interface for configuring angular modules.
|
||||
see: http://docs.angularjs.org/api/angular.Module
|
||||
*/
|
||||
module(
|
||||
/** name of your module you want to create */
|
||||
name: string,
|
||||
/** name of modules yours depends on */
|
||||
requires?: string[],
|
||||
configFunction?: Function): IModule;
|
||||
/** name of your module you want to create */
|
||||
name: string,
|
||||
/** name of modules yours depends on */
|
||||
requires?: string[],
|
||||
configFunction?: Function): IModule;
|
||||
noop(...args: any[]): void;
|
||||
toJson(obj: any, pretty?: bool): string;
|
||||
uppercase(str: string): string;
|
||||
@@ -72,11 +72,11 @@ module ng {
|
||||
// see http://docs.angularjs.org/api/angular.Module
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
interface IModule {
|
||||
/** configure existing services.
|
||||
/** configure existing services.
|
||||
Use this method to register work which needs to be performed on module loading
|
||||
*/
|
||||
config(configFn: Function): IModule;
|
||||
/** configure existing services.
|
||||
config(configFn: Function): IModule;
|
||||
/** configure existing services.
|
||||
Use this method to register work which needs to be performed on module loading
|
||||
*/
|
||||
config(inlineAnnotadedFunction: any[]): IModule;
|
||||
@@ -84,17 +84,17 @@ module ng {
|
||||
controller(name: string, controllerConstructor: Function): IModule;
|
||||
controller(name: string, inlineAnnotadedConstructor: any[]): IModule;
|
||||
directive(name: string, directiveFactory: Function): IModule;
|
||||
directive(name: string, inlineAnnotadedFunction: any[]): IModule;
|
||||
directive(name: string, inlineAnnotadedFunction: any[]): IModule;
|
||||
factory(name: string, serviceFactoryFunction: Function): IModule;
|
||||
factory(name: string, inlineAnnotadedFunction: any[]): IModule;
|
||||
factory(name: string, inlineAnnotadedFunction: any[]): IModule;
|
||||
filter(name: string, filterFactoryFunction: Function): IModule;
|
||||
filter(name: string, inlineAnnotadedFunction: any[]): IModule;
|
||||
filter(name: string, inlineAnnotadedFunction: any[]): IModule;
|
||||
provider(name: string, serviceProviderConstructor: Function): IModule;
|
||||
provider(name: string, inlineAnnotadedConstructor: any[]): IModule;
|
||||
run(initializationFunction: Function): IModule;
|
||||
run(inlineAnnotadedFunction: any[]): IModule;
|
||||
run(inlineAnnotadedFunction: any[]): IModule;
|
||||
service(name: string, serviceConstructor: Function): IModule;
|
||||
service(name: string, inlineAnnotadedConstructor: any[]): IModule;
|
||||
service(name: string, inlineAnnotadedConstructor: any[]): IModule;
|
||||
value(name: string, value: any): IModule;
|
||||
|
||||
// Properties
|
||||
@@ -139,14 +139,14 @@ module ng {
|
||||
|
||||
// XXX Same as avove
|
||||
$modelValue: any;
|
||||
|
||||
|
||||
$parsers: IModelParser[];
|
||||
$formatters: IModelFormatter[];
|
||||
$error: any;
|
||||
$pristine: bool;
|
||||
$dirty: bool;
|
||||
$valid: bool;
|
||||
$invalid: bool;
|
||||
$invalid: bool;
|
||||
}
|
||||
|
||||
interface IModelParser {
|
||||
@@ -165,12 +165,12 @@ module ng {
|
||||
// Documentation says exp is optional, but actual implementaton counts on it
|
||||
$apply(exp: string): any;
|
||||
$apply(exp: (scope: IScope) => any): any;
|
||||
|
||||
|
||||
$broadcast(name: string, ...args: any[]): IAngularEvent;
|
||||
$destroy(): void;
|
||||
$digest(): void;
|
||||
$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;
|
||||
@@ -183,25 +183,25 @@ module ng {
|
||||
$new(isolate?: bool): IScope;
|
||||
|
||||
$on(name: string, listener: (event: IAngularEvent, ...args: any[]) => any): Function;
|
||||
|
||||
|
||||
$watch(watchExpression: string, listener?: string, objectEquality?: bool): Function;
|
||||
$watch(watchExpression: string, listener?: (newValue: any, oldValue: any, scope: IScope) => any, objectEquality?: bool): Function;
|
||||
$watch(watchExpression: (scope: IScope) => any, listener?: string, objectEquality?: bool): Function;
|
||||
$watch(watchExpression: (scope: IScope) => any, listener?: (newValue: any, oldValue: any, scope: IScope) => any, objectEquality?: bool): Function;
|
||||
|
||||
|
||||
$id: number;
|
||||
}
|
||||
|
||||
interface IAngularEvent {
|
||||
targetScope: IScope;
|
||||
currentScope: IScope;
|
||||
name: string;
|
||||
name: string;
|
||||
preventDefault: Function;
|
||||
defaultPrevented: bool;
|
||||
|
||||
// Available only events that were $emit-ted
|
||||
stopPropagation?: Function;
|
||||
}
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// WindowService
|
||||
@@ -386,12 +386,12 @@ module ng {
|
||||
}
|
||||
|
||||
interface IPromise {
|
||||
then(successCallback: Function, errorCallback?: Function): IPromise;
|
||||
then(successCallback: (promiseValue: any) => any, errorCallback?: (reason: any) => any): IPromise;
|
||||
}
|
||||
|
||||
interface IDeferred {
|
||||
resolve(value?: any): void;
|
||||
reject(reason?: string): void;
|
||||
reject(reason?: any): void;
|
||||
promise: IPromise;
|
||||
}
|
||||
|
||||
@@ -420,7 +420,7 @@ module ng {
|
||||
|
||||
// Methods bellow are not documented
|
||||
info(): any;
|
||||
get(cacheId: string): ICacheObject;
|
||||
get (cacheId: string): ICacheObject;
|
||||
}
|
||||
|
||||
interface ICacheObject {
|
||||
@@ -432,7 +432,7 @@ module ng {
|
||||
//capacity: number;
|
||||
};
|
||||
put(key: string, value?: any): void;
|
||||
get(key: string): any;
|
||||
get (key: string): any;
|
||||
remove(key: string): void;
|
||||
removeAll(): void;
|
||||
destroy(): void;
|
||||
@@ -484,8 +484,8 @@ module ng {
|
||||
interface IHttpService {
|
||||
// At least moethod and url must be provided...
|
||||
(config: IRequestConfig): IHttpPromise;
|
||||
get(url: string, RequestConfig?: any): IHttpPromise;
|
||||
delete(url: string, RequestConfig?: any): IHttpPromise;
|
||||
get (url: string, RequestConfig?: any): IHttpPromise;
|
||||
delete (url: string, RequestConfig?: any): IHttpPromise;
|
||||
head(url: string, RequestConfig?: any): IHttpPromise;
|
||||
jsonp(url: string, RequestConfig?: any): IHttpPromise;
|
||||
post(url: string, data: any, RequestConfig?: any): IHttpPromise;
|
||||
@@ -503,10 +503,10 @@ module ng {
|
||||
method: string;
|
||||
url: string;
|
||||
params?: any;
|
||||
|
||||
|
||||
// XXX it has it's own structure... perhaps we should define it in the future
|
||||
headers?: any;
|
||||
|
||||
|
||||
cache?: any;
|
||||
timeout?: number;
|
||||
withCredentials?: bool;
|
||||
@@ -517,12 +517,20 @@ module ng {
|
||||
transformResponse?: any;
|
||||
}
|
||||
|
||||
interface IHttpPromiseCallbackArg {
|
||||
data?: any;
|
||||
status?: number;
|
||||
headers?: (headerName: string) => string;
|
||||
config?: IRequestConfig;
|
||||
}
|
||||
|
||||
interface IHttpPromise extends IPromise {
|
||||
success(callback: (data: any, status: number, headers: (headerName: string) => string, config: IRequestConfig) => any): IHttpPromise;
|
||||
error(callback: (data: any, status: number, headers: (headerName: string) => string, config: IRequestConfig) => any): IHttpPromise;
|
||||
then(successCallback: (response: IHttpPromiseCallbackArg) => any, errorCallback?: (response: IHttpPromiseCallbackArg) => any): IPromise;
|
||||
}
|
||||
|
||||
interface IHttpProvider extends IServiceProvider {
|
||||
interface IHttpProvider extends IServiceProvider {
|
||||
defaults: IRequestConfig;
|
||||
responseInterceptors: any[];
|
||||
}
|
||||
@@ -589,7 +597,7 @@ module ng {
|
||||
// May not always be available. For instance, current will not be available
|
||||
// to a controller that was not initialized as a result of a route maching.
|
||||
current?: ICurrentRoute;
|
||||
}
|
||||
}
|
||||
|
||||
// see http://docs.angularjs.org/api/ng.$routeProvider#when for options explanations
|
||||
interface IRoute {
|
||||
@@ -609,9 +617,9 @@ module ng {
|
||||
};
|
||||
}
|
||||
|
||||
interface IRouteProviderProvider extends IServiceProvider {
|
||||
otherwise(params: any): IRouteProviderProvider;
|
||||
when(path: string, route: IRoute): IRouteProviderProvider;
|
||||
interface IRouteProvider extends IServiceProvider {
|
||||
otherwise(params: any): IRouteProvider;
|
||||
when(path: string, route: IRoute): IRouteProvider;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
@@ -626,7 +634,7 @@ module ng {
|
||||
interface IInjectorService {
|
||||
annotate(fn: Function): string[];
|
||||
annotate(inlineAnnotadedFunction: any[]): string[];
|
||||
get(name: string): any;
|
||||
get (name: string): any;
|
||||
instantiate(typeConstructor: Function, locals?: any): any;
|
||||
invoke(func: Function, context?: any, locals?: any): any;
|
||||
}
|
||||
|
||||
Vendored
+33
@@ -0,0 +1,33 @@
|
||||
// Type definitions for typescript.bgiframe 1.0
|
||||
// Project: https://github.com/sumegizoltan/BgiFrame
|
||||
// Definitions by: Zoltan Sumegi <https://github.com/sumegizoltan>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
/*! The plugin based on:
|
||||
*
|
||||
* bgiframe for IE6
|
||||
* https://github.com/brandonaaron/bgiframe
|
||||
*
|
||||
* Copyrights for the jQuery plugin:
|
||||
* Copyright (c) 2013 Brandon Aaron (http://brandonaaron.net)
|
||||
*/
|
||||
|
||||
module BgiFrame {
|
||||
interface ISettings {
|
||||
top: string;
|
||||
left: string;
|
||||
width: string;
|
||||
height: string;
|
||||
opacity: bool;
|
||||
src: string;
|
||||
conditional: bool;
|
||||
}
|
||||
|
||||
interface IBgiframe {
|
||||
s: ISettings;
|
||||
createIframe(): HTMLElement;
|
||||
fire(element: HTMLElement): void;
|
||||
getIframe(element: HTMLElement): HTMLElement;
|
||||
prop(n: any): string;
|
||||
}
|
||||
}
|
||||
@@ -279,10 +279,10 @@ function test_entityManager() {
|
||||
var entity = changeArgs.entity;
|
||||
});
|
||||
var em = new breeze.EntityManager({ serviceName: "api/NorthwindIBModel" });
|
||||
//em.hasChanges.subscribe(function (args) {
|
||||
// var hasChanges = args.hasChanges;
|
||||
// var entityManager = args.entityManager;
|
||||
//});
|
||||
em.hasChangesChanged.subscribe(function (args) {
|
||||
var hasChangesChanged = args.hasChanges;
|
||||
var entityManager = args.entityManager;
|
||||
});
|
||||
}
|
||||
|
||||
function test_entityQuery() {
|
||||
@@ -784,4 +784,4 @@ function test_demo() {
|
||||
.from("Employees");
|
||||
|
||||
manager.executeQuery(query).then(function (data) { });
|
||||
}
|
||||
}
|
||||
|
||||
Vendored
+3
-2
@@ -280,7 +280,7 @@ declare module Breeze {
|
||||
validationOptions: ValidationOptions;
|
||||
|
||||
entityChanged: EntityChangedEvent;
|
||||
// hasChanges: BreezeCore.Event;
|
||||
hasChangesChanged: BreezeCore.Event;
|
||||
|
||||
constructor (config?: EntityManagerOptions);
|
||||
constructor (config?: string);
|
||||
@@ -290,6 +290,7 @@ declare module Breeze {
|
||||
clear(): void;
|
||||
createEmptyCopy(): EntityManager;
|
||||
detachEntity(entity: Entity): bool;
|
||||
createEntity(entityTypeName: string, propertyInitializer: {}): Entity;
|
||||
|
||||
executeQuery(query: string, callback?: ExecuteQuerySuccessCallback, errorCallback?: ExecuteQueryErrorCallback): Promise;
|
||||
executeQuery(query: EntityQuery, callback?: ExecuteQuerySuccessCallback, errorCallback?: ExecuteQueryErrorCallback): Promise;
|
||||
@@ -727,4 +728,4 @@ declare module Breeze {
|
||||
messageTemplate: string;
|
||||
message?: string;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,50 @@
|
||||
///<reference path="commander.d.ts"/>
|
||||
|
||||
//
|
||||
// TODO: improve tests
|
||||
// [the code below was extracted from the documentation and examples, but does not seem to cover all cases]
|
||||
//
|
||||
|
||||
import program = module("commander");
|
||||
|
||||
program
|
||||
.version('0.0.1')
|
||||
.option('-C, --chdir <path>', 'change the working directory')
|
||||
.option('-c, --config <path>', 'set config path [./deploy.conf]')
|
||||
.option('-T, --no-tests', 'ignore test hook')
|
||||
|
||||
// $ deploy setup stage
|
||||
// $ deploy setup
|
||||
program
|
||||
.command('setup [env]')
|
||||
.description('run setup commands for all envs')
|
||||
.action(function (env) {
|
||||
env = env || 'all';
|
||||
console.log('setup for %s env(s)', env);
|
||||
});
|
||||
|
||||
// $ deploy stage
|
||||
// $ deploy production
|
||||
program
|
||||
.command('*')
|
||||
.action(function (env) {
|
||||
console.log('deploying "%s"', env);
|
||||
});
|
||||
|
||||
program.option('-p, --pepper', 'add pepper');
|
||||
|
||||
program.option('-C, --chdir <path>', 'change the working directory');
|
||||
|
||||
program.prompt('Username: ', function (name) {
|
||||
console.log('hi %s', name);
|
||||
});
|
||||
|
||||
program.prompt('Description:', function (desc) {
|
||||
console.log('description was "%s"', desc.trim());
|
||||
});
|
||||
|
||||
program.promptForNumber("Enter a number:", (n) => { });
|
||||
|
||||
program.confirm("Confirm? ", (f) => { });
|
||||
|
||||
program.choose(["a", "b", "c"], (i) => { });
|
||||
Vendored
+228
@@ -0,0 +1,228 @@
|
||||
// Type definitions for commanderjs 1.1.1
|
||||
// Project: https://github.com/visionmedia/commander.js
|
||||
// Definitions by: Marcelo Dezem <http://github.com/mdezem>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
declare module "commander" {
|
||||
export interface Command {
|
||||
/**
|
||||
* The command name.
|
||||
*/
|
||||
name: string;
|
||||
|
||||
//
|
||||
//
|
||||
// NOTE: the methods below are COPIED to the module
|
||||
// as functions exports. If changes need to be made here,
|
||||
// remember to re-paste the definitions in the module.
|
||||
// Read below to know why such ugly thing is required.
|
||||
//
|
||||
//
|
||||
|
||||
/**
|
||||
* Register callback fn for the command.
|
||||
*/
|
||||
action(fn: (...args: any[]) => any): Command;
|
||||
|
||||
/**
|
||||
* Define option with flags, description and optional coercion function and default value.
|
||||
* The flags string should contain both the short and long flags
|
||||
* separated by comma, a pipe or space. The following are all valid
|
||||
* all will output this way when --help is used.
|
||||
*
|
||||
* "-p, --pepper"
|
||||
* "-p|--pepper"
|
||||
* "-p --pepper"
|
||||
*
|
||||
* @param flags the option flags.
|
||||
* @param description the option description. The description is printed when "--help" is used.
|
||||
* @param coerceFn (optional) specifies a callback function to coerce the option arg.
|
||||
* @param defaultValue (optional) specifies a default value.
|
||||
*/
|
||||
option(flags: string, description: string, coerceFn?: (value: string) => any, defaultValue?: any): Command;
|
||||
|
||||
|
||||
/**
|
||||
* Sets the command version
|
||||
*/
|
||||
version(version: string): Command;
|
||||
|
||||
/**
|
||||
* Parse the arguments array and invokes the commands passing the parsed options.
|
||||
* @param argv the arguments array.
|
||||
*/
|
||||
parse(argv: string[]): Command;
|
||||
|
||||
/**
|
||||
* Gets or sets the command description.
|
||||
* @param description the new description for the command. When ommited this returns the current description, otherwise returns the current Command.
|
||||
*/
|
||||
description(description: string): Command;
|
||||
description(): string;
|
||||
|
||||
/**
|
||||
* Gets or sets the usage help string.
|
||||
*/
|
||||
usage(usage: string): Command;
|
||||
usage(): string;
|
||||
|
||||
/*
|
||||
* Prompt the user for a value, calling the callback function.
|
||||
*
|
||||
* Supports single-line and multi-line prompts.
|
||||
* To issue a single-line prompt simply add a whitespace
|
||||
* to the end of label, something like "name: ", whereas
|
||||
* for a multi-line prompt omit this "description:".
|
||||
* @param label the label string to be printed in console.
|
||||
* @param callback a callback function to handle the inputed string.
|
||||
*/
|
||||
prompt(label: string, callback: (value: string) => any): void;
|
||||
|
||||
promptForNumber(label: string, callback: (value: number) => any): void;
|
||||
promptForDate(label: string, callback: (value: Date) => any): void;
|
||||
promptSingleLine(label: string, callback: (value: string) => any): void;
|
||||
promptMultiLine(label: string, callback: (value: string) => any): void;
|
||||
|
||||
/**
|
||||
* Prompt for password with a label, a optional mask char and callback function.
|
||||
* The mask string defaults to '', aka no output is written while typing, you may want to use "*" etc.
|
||||
*/
|
||||
password(label: string, mask: string, callback: (value: string) => any): void;
|
||||
password(label: string, callback: (value: string) => any): void;
|
||||
|
||||
/**
|
||||
* Prompts the user for a confirmation.
|
||||
*/
|
||||
confirm(label: string, callback: (flag: bool) => any): void;
|
||||
|
||||
/**
|
||||
* Prompt for password with str, mask char and callback fn(val).
|
||||
* The mask string defaults to '', aka no output is written while typing, you may want to use "*" etc.
|
||||
*/
|
||||
choose(options: string[], callback: (idx: number) => any): void;
|
||||
choose(options: any[], callback: (idx: number) => any): void;
|
||||
|
||||
/**
|
||||
* Add command with the specified name. Returns a new instance of Command.
|
||||
*
|
||||
* The .action() callback is invoked when the
|
||||
* command name is specified via ARGV,
|
||||
* and the remaining arguments are applied to the
|
||||
* function for access.
|
||||
|
||||
* When the name is "*" an un-matched command
|
||||
* will be passed as the first arg, followed by
|
||||
* the rest of ARGV remaining.
|
||||
*
|
||||
* @param name the name of the command. Pass "*" to trap un-matched commands.
|
||||
*/
|
||||
command(name: string): Command;
|
||||
}
|
||||
|
||||
//
|
||||
//
|
||||
// since TypeScript (and ECMA6) does not supports module.exports,
|
||||
// there is no way to set the default Command instance as the module itself.
|
||||
// It's ugly but the only way is to copy all the methods from Command
|
||||
// and paste it in the module as functions exports.
|
||||
//
|
||||
//
|
||||
|
||||
/**
|
||||
* Register callback fn for the command.
|
||||
*/
|
||||
export function action(fn: (...args: any[]) => any): Command;
|
||||
|
||||
/**
|
||||
* Define option with flags, description and optional coercion function and default value.
|
||||
* The flags string should contain both the short and long flags
|
||||
* separated by comma, a pipe or space. The following are all valid
|
||||
* all will output this way when --help is used.
|
||||
*
|
||||
* "-p, --pepper"
|
||||
* "-p|--pepper"
|
||||
* "-p --pepper"
|
||||
*
|
||||
* @param flags the option flags.
|
||||
* @param description the option description. The description is printed when "--help" is used.
|
||||
* @param coerceFn (optional) specifies a callback function to coerce the option arg.
|
||||
* @param defaultValue (optional) specifies a default value.
|
||||
*/
|
||||
export function option(flags: string, description: string, coerceFn?: (value: string) => any, defaultValue?: any): Command;
|
||||
|
||||
|
||||
/**
|
||||
* Sets the command version
|
||||
*/
|
||||
export function version(version: string): Command;
|
||||
|
||||
/**
|
||||
* Parse the arguments array and invokes the commands passing the parsed options.
|
||||
* @param argv the arguments array.
|
||||
*/
|
||||
export function parse(argv: string[]): Command;
|
||||
|
||||
/**
|
||||
* Gets or sets the command description.
|
||||
* @param description the new description for the command. When ommited this returns the current description, otherwise returns the current Command.
|
||||
*/
|
||||
export function description(description: string): Command;
|
||||
export function description(): string;
|
||||
|
||||
/**
|
||||
* Gets or sets the usage help string.
|
||||
*/
|
||||
export function usage(usage: string): Command;
|
||||
export function usage(): string;
|
||||
|
||||
/*
|
||||
* Prompt the user for a value, calling the callback function.
|
||||
*
|
||||
* Supports single-line and multi-line prompts.
|
||||
* To issue a single-line prompt simply add a whitespace
|
||||
* to the end of label, something like "name: ", whereas
|
||||
* for a multi-line prompt omit this "description:".
|
||||
* @param label the label string to be printed in console.
|
||||
* @param callback a callback function to handle the inputed string.
|
||||
*/
|
||||
export function prompt(label: string, callback: (value: string) => any): void;
|
||||
|
||||
export function promptForNumber(label: string, callback: (value: number) => any): void;
|
||||
export function promptForDate(label: string, callback: (value: Date) => any): void;
|
||||
export function promptSingleLine(label: string, callback: (value: string) => any): void;
|
||||
export function promptMultiLine(label: string, callback: (value: string) => any): void;
|
||||
/**
|
||||
* Prompt for password with a label, a optional mask char and callback function.
|
||||
* The mask string defaults to '', aka no output is written while typing, you may want to use "*" etc.
|
||||
*/
|
||||
export function password(label: string, mask: string, callback: (value: string) => any): void;
|
||||
export function password(label: string, callback: (value: string) => any): void;
|
||||
|
||||
/**
|
||||
* Prompts the user for a confirmation.
|
||||
*/
|
||||
export function confirm(label: string, callback: (flag: bool) => any): void;
|
||||
|
||||
/**
|
||||
* Prompt for password with str, mask char and callback fn(val).
|
||||
* The mask string defaults to '', aka no output is written while typing, you may want to use "*" etc.
|
||||
*/
|
||||
export function choose(options: string[], callback: (idx: number) => any): void;
|
||||
export function choose(options: any[], callback: (idx: number) => any): void;
|
||||
|
||||
/**
|
||||
* Add command with the specified name. Returns a new instance of Command.
|
||||
*
|
||||
* The .action() callback is invoked when the
|
||||
* command name is specified via ARGV,
|
||||
* and the remaining arguments are applied to the
|
||||
* function for access.
|
||||
|
||||
* When the name is "*" an un-matched command
|
||||
* will be passed as the first arg, followed by
|
||||
* the rest of ARGV remaining.
|
||||
*
|
||||
* @param name the name of the command. Pass "*" to trap un-matched commands.
|
||||
*/
|
||||
export function command(name: string): Command;
|
||||
}
|
||||
Vendored
+15
-3
@@ -64,7 +64,7 @@ declare module "durandal/app" {
|
||||
* @param transition If you have a splash screen, you may want to specify an optional transition to animate from the splash to your main shell.
|
||||
* @param applicationHost parameter is optional. If provided it should be an element id for the node into which the UI should be composed. If it is not provided the default is to look for an element with an id of "applicationHost".
|
||||
*/
|
||||
export var setRoot: (root: any, transition: string, applicationHost: string) => void;
|
||||
export var setRoot: (root: any, transition: string, applicationHost?: string) => void;
|
||||
/**
|
||||
* If you intend to run on mobile, you should also call app.adaptToDevice() before setting the root.
|
||||
*/
|
||||
@@ -368,6 +368,10 @@ declare module "durandal/plugins/router" {
|
||||
* An observable whose value is the currently active item/module/page.
|
||||
*/
|
||||
export var activeItem: IDurandalViewModelActiveItem;
|
||||
/**
|
||||
* An observable whose value is the currently active route.
|
||||
*/
|
||||
export var activeRoute: KnockoutObservableAny;
|
||||
/**
|
||||
* called after an a new module is composed
|
||||
*/
|
||||
@@ -376,6 +380,10 @@ declare module "durandal/plugins/router" {
|
||||
* Causes the router to move backwards in page history.
|
||||
*/
|
||||
export var navigateBack: () => void;
|
||||
/**
|
||||
* Use router default convention.
|
||||
*/
|
||||
export var useConvention: () => void;
|
||||
/**
|
||||
* Causes the router to navigate to a specific url.
|
||||
*/
|
||||
@@ -400,6 +408,10 @@ declare module "durandal/plugins/router" {
|
||||
* This should not normally be overwritten. But advanced users can override this to completely transform the developer's routeInfo input into the final version used to configure the router.
|
||||
*/
|
||||
export var prepareRouteInfo: (info: routeInfo) => void;
|
||||
/**
|
||||
* This should not normally be overwritten. But advanced users can override this to completely transform the developer's routeInfo input into the final version used to configure the router.
|
||||
*/
|
||||
export var handleInvalidRoute: (route: routeInfo, parameters: any) => void;
|
||||
/**
|
||||
* Once the router is required, you can call router.mapAuto(). This is the most basic configuration option. When you call this function (with no parameters) it tells the router to directly correlate route parameters to module names in the viewmodels folder.
|
||||
*/
|
||||
@@ -411,7 +423,7 @@ declare module "durandal/plugins/router" {
|
||||
/**
|
||||
* You can pass a single routeInfo to this function, or you can pass the basic configuration parameters. url is your url pattern, moduleId is the module path this pattern will map to, name is used as the document title and visible determines whether or not to include it in the router's visibleRoutes array for easy navigation UI binding.
|
||||
*/
|
||||
export var mapRoute: (url: string, moduleId: string, name: string, visible: bool) => routeInfo;
|
||||
export var mapRoute: (urlOrRouteInfo: any, moduleId?: string, name?: string, visible?: bool) => routeInfo;
|
||||
/**
|
||||
* This function takes an array of routeInfo objects or a single routeInfo object and uses it to configure the router. The finalized routeInfo (or array of infos) is returned.
|
||||
*/
|
||||
@@ -423,4 +435,4 @@ declare module "durandal/plugins/router" {
|
||||
* After you've configured the router, you need to activate it. This is usually done in your shell. The activate function of the router returns a promise that resolves when the router is ready to start. To use the router, you should add an activate function to your shell and return the result from that. The application startup infrastructure of Durandal will detect your shell's activate function and call it at the appropriate time, waiting for it's promise to resolve. This allows Durandal to properly orchestrate the timing of composition and databinding along with animations and splash screen display.
|
||||
*/
|
||||
export var activate: (defaultRoute: string) => JQueryPromise;
|
||||
}
|
||||
}
|
||||
|
||||
Vendored
+74
-55
@@ -78,15 +78,19 @@ module createjs {
|
||||
mousedown: (event: MouseEvent) => any;
|
||||
tick: () => any;
|
||||
|
||||
// EventDispatcher mixins
|
||||
addEventListener(type: string, listener: (eventObj: Object) => bool): Function;
|
||||
addEventListener(type: string, listener: (eventObj: Object) => bool): Object;
|
||||
removeEventListener(type: string, listener: (eventObj: Function) => bool): void;
|
||||
removeEventListener(type: string, listener: (eventObj: Object) => bool): void;
|
||||
removeAllEventListeners(type: string): void;
|
||||
dispatchEvent(eventObj: string, target: Object): bool;
|
||||
dispatchEvent(eventObj: Object, target: Object): bool;
|
||||
hasEventListener(type: string): bool;
|
||||
// EventDispatcher mixins
|
||||
addEventListener(type: string, listener: (eventObj: Object) => bool): Function;
|
||||
addEventListener(type: string, listener: (eventObj: Object) => void): Function;
|
||||
addEventListener(type: string, listener: { handleEvent: (eventObj: Object) => bool; }): Object;
|
||||
addEventListener(type: string, listener: { handleEvent: (eventObj: Object) => void; }): Object;
|
||||
removeEventListener(type: string, listener: (eventObj: Object) => bool): void;
|
||||
removeEventListener(type: string, listener: (eventObj: Object) => void): void;
|
||||
removeEventListener(type: string, listener: { handleEvent: (eventObj: Object) => bool; }): void;
|
||||
removeEventListener(type: string, listener: { handleEvent: (eventObj: Object) => void; }): void;
|
||||
removeAllEventListeners(type: string): void;
|
||||
dispatchEvent(eventObj: string, target: Object): bool;
|
||||
dispatchEvent(eventObj: Object, target: Object): bool;
|
||||
hasEventListener(type: string): bool;
|
||||
}
|
||||
|
||||
|
||||
@@ -166,20 +170,20 @@ module createjs {
|
||||
onAnimationEnd: (event: Object) => any;
|
||||
}
|
||||
|
||||
export class ButtonHelper {
|
||||
// properties
|
||||
target: Object;
|
||||
overLabel: string;
|
||||
outLabel: string;
|
||||
downLabel: string;
|
||||
play: bool;
|
||||
export class ButtonHelper {
|
||||
// properties
|
||||
target: Object;
|
||||
overLabel: string;
|
||||
outLabel: string;
|
||||
downLabel: string;
|
||||
play: bool;
|
||||
|
||||
// methods
|
||||
constructor(target: MovieClip, outLabel: string, overLabel: string, downLabel: string, play: bool, hitArea: DisplayObject, hitLabel: string);
|
||||
constructor(target: BitmapAnimation, outLabel: string, overLabel: string, downLabel: string, play: bool, hitArea: DisplayObject, hitLabel: string);
|
||||
setEnabled(value: bool);
|
||||
toString(): string;
|
||||
}
|
||||
// methods
|
||||
constructor(target: MovieClip, outLabel: string, overLabel: string, downLabel: string, play: bool, hitArea: DisplayObject, hitLabel: string);
|
||||
constructor(target: BitmapAnimation, outLabel: string, overLabel: string, downLabel: string, play: bool, hitArea: DisplayObject, hitLabel: string);
|
||||
setEnabled(value: bool);
|
||||
toString(): string;
|
||||
}
|
||||
|
||||
export class BoxBlurFilter extends Filter {
|
||||
// properties
|
||||
@@ -280,27 +284,31 @@ module createjs {
|
||||
|
||||
|
||||
export class EaselJS {
|
||||
// properties
|
||||
version: string;
|
||||
buildDate: string;
|
||||
// properties
|
||||
version: string;
|
||||
buildDate: string;
|
||||
}
|
||||
|
||||
|
||||
export class EventDispatcher {
|
||||
// properties
|
||||
// properties
|
||||
|
||||
// methods
|
||||
static initialize(target: Object): void;
|
||||
// methods
|
||||
static initialize(target: Object): void;
|
||||
|
||||
addEventListener(type: string, listener: (eventObj: Object) => bool): Function;
|
||||
addEventListener(type: string, listener: (eventObj: Object) => bool): Object;
|
||||
removeEventListener(type: string, listener: (eventObj: Function) => bool): void;
|
||||
removeEventListener(type: string, listener: (eventObj: Object) => bool): void;
|
||||
removeAllEventListeners(type: string): void;
|
||||
dispatchEvent(eventObj: string, target: Object): bool;
|
||||
dispatchEvent(eventObj: Object, target: Object): bool;
|
||||
hasEventListener(type: string): bool;
|
||||
toString(): string;
|
||||
addEventListener(type: string, listener: (eventObj: Object) => bool): Function;
|
||||
addEventListener(type: string, listener: (eventObj: Object) => void): Function;
|
||||
addEventListener(type: string, listener: { handleEvent: (eventObj: Object) => bool; }): Object;
|
||||
addEventListener(type: string, listener: { handleEvent: (eventObj: Object) => void; }): Object;
|
||||
removeEventListener(type: string, listener: (eventObj: Object) => bool): void;
|
||||
removeEventListener(type: string, listener: (eventObj: Object) => void): void;
|
||||
removeEventListener(type: string, listener: { handleEvent: (eventObj: Object) => bool; }): void;
|
||||
removeEventListener(type: string, listener: { handleEvent: (eventObj: Object) => void; }): void;
|
||||
removeAllEventListeners(type: string): void;
|
||||
dispatchEvent(eventObj: string, target: Object): bool;
|
||||
dispatchEvent(eventObj: Object, target: Object): bool;
|
||||
hasEventListener(type: string): bool;
|
||||
toString(): string;
|
||||
}
|
||||
|
||||
|
||||
@@ -352,20 +360,20 @@ module createjs {
|
||||
}
|
||||
|
||||
|
||||
export class Log {
|
||||
// properties
|
||||
static NONE: number;
|
||||
static ERROR: number;
|
||||
static WARNING: number;
|
||||
static TRACE: number;
|
||||
static ALL: number;
|
||||
static level: number;
|
||||
export class Log {
|
||||
// properties
|
||||
static NONE: number;
|
||||
static ERROR: number;
|
||||
static WARNING: number;
|
||||
static TRACE: number;
|
||||
static ALL: number;
|
||||
static level: number;
|
||||
|
||||
// methods
|
||||
static out(message: string, details: string, level: number);
|
||||
static addKeys(keys: Object);
|
||||
static log(message: string, details: string, level: number);
|
||||
}
|
||||
// methods
|
||||
static out(message: string, details: string, level: number);
|
||||
static addKeys(keys: Object);
|
||||
static log(message: string, details: string, level: number);
|
||||
}
|
||||
|
||||
export class Matrix2D {
|
||||
// properties
|
||||
@@ -552,14 +560,15 @@ module createjs {
|
||||
toString(): string;
|
||||
|
||||
// events
|
||||
complete: (event: Object) => any;
|
||||
onProgress: (event: Object) => any;
|
||||
complete: (event: Object) => any;
|
||||
onProgress: (event: Object) => any;
|
||||
}
|
||||
|
||||
|
||||
export class SpriteSheetUtils {
|
||||
static addFlippedFrames(spriteSheet: SpriteSheet, horizontal?: bool, vertical?: bool, both?: bool): void;
|
||||
static extractFrame(spriteSheet: HTMLImageElement, frame: number): HTMLImageElement;
|
||||
static extractFrame(spriteSheet: SpriteSheet, frame: number): HTMLImageElement;
|
||||
static extractFrame(spriteSheet: SpriteSheet, animationName: string): HTMLImageElement;
|
||||
static flip(spriteSheet: HTMLImageElement, flipData: Object): void;
|
||||
static mergeAlpha(rgbImage: HTMLImageElement, alphaImage: HTMLImageElement, canvas?: HTMLCanvasElement): HTMLCanvasElement;
|
||||
}
|
||||
@@ -582,11 +591,11 @@ module createjs {
|
||||
constructor (canvas: HTMLCanvasElement);
|
||||
clone(): Stage;
|
||||
enableMouseOver(frequency: number): void;
|
||||
enableDOMEvents(enable: bool): void;
|
||||
enableDOMEvents(enable: bool): void;
|
||||
toDataURL(backgroundColor: string, mimeType: string): string;
|
||||
update(): void;
|
||||
clear(): void;
|
||||
handleEvent(evt: Object): void;
|
||||
handleEvent(evt: Object): void;
|
||||
|
||||
// events
|
||||
stagemousemove: (event: MouseEvent) => any;
|
||||
@@ -634,6 +643,16 @@ module createjs {
|
||||
static setInterval(interval: number): void;
|
||||
static setPaused(value: bool): void;
|
||||
|
||||
// EventDispatcher mixins
|
||||
static addEventListener(type: string, listener: (eventObj: Object) => bool): Function;
|
||||
static addEventListener(type: string, listener: (eventObj: Object) => void): Function;
|
||||
static addEventListener(type: string, listener: { handleEvent: (eventObj: Object) => bool; }): Object;
|
||||
static addEventListener(type: string, listener: { handleEvent: (eventObj: Object) => void; }): Object;
|
||||
static removeEventListener(type: string, listener: (eventObj: Object) => bool): void;
|
||||
static removeEventListener(type: string, listener: (eventObj: Object) => void): void;
|
||||
static removeEventListener(type: string, listener: { handleEvent: (eventObj: Object) => bool; }): void;
|
||||
static removeEventListener(type: string, listener: { handleEvent: (eventObj: Object) => void; }): void;
|
||||
|
||||
// events
|
||||
tick: (timeElapsed: number) => any;
|
||||
}
|
||||
|
||||
Vendored
+1
@@ -758,6 +758,7 @@ declare module fabric {
|
||||
fromURL(url: string): IImage;
|
||||
fromURL(url: string, callback: (image: IImage) => any): IImage;
|
||||
fromURL(url: string, callback: (image: IImage) => any, objObjects: IObjectOptions): IImage;
|
||||
new (element: HTMLImageElement, objObjects: IObjectOptions): IImage;
|
||||
prototype: any;
|
||||
|
||||
filters:
|
||||
|
||||
@@ -0,0 +1,72 @@
|
||||
/// <reference path="gamepad.d.ts" />
|
||||
|
||||
|
||||
()=>{
|
||||
function runAnimation()
|
||||
{
|
||||
window.requestAnimationFrame(runAnimation);
|
||||
|
||||
var gamepads = navigator.getGamepads();
|
||||
|
||||
for (var i = 0; i < gamepads.length; ++i)
|
||||
{
|
||||
var pad = gamepads[i];
|
||||
// todo; simple demo of displaying pad.axes and pad.buttons
|
||||
}
|
||||
}
|
||||
|
||||
window.requestAnimationFrame(runAnimation);
|
||||
};
|
||||
|
||||
()=>{
|
||||
window.addEventListener('GamepadConnected', (e: GamepadEvent)=>{
|
||||
console.log('Gamepad ' + e.gamepad.index + ' connected!');
|
||||
}, false);
|
||||
window.addEventListener('GamepadDisconnected', (e: GamepadEvent)=>{
|
||||
console.log('Gamepad ' + e.gamepad.index + ' disconnected!');
|
||||
}, false);
|
||||
window.addEventListener('webkitGamepadConnected', (e: GamepadEvent)=>{
|
||||
console.log('Gamepad ' + e.gamepad.index + ' connected!');
|
||||
}, false);
|
||||
window.addEventListener('webkitGamepadDisconnected', (e: GamepadEvent)=>{
|
||||
console.log('Gamepad ' + e.gamepad.index + ' disconnected!');
|
||||
}, false);
|
||||
window.addEventListener('mozGamepadConnected', (e: GamepadEvent)=>{
|
||||
console.log('Gamepad ' + e.gamepad.index + ' connected!');
|
||||
}, false);
|
||||
window.addEventListener('mozGamepadDisconnected', (e: GamepadEvent)=>{
|
||||
console.log('Gamepad ' + e.gamepad.index + ' disconnected!');
|
||||
}, false);
|
||||
|
||||
var requestAnimationFrame = window.requestAnimationFrame || window["mozRequestAnimationFrame"];
|
||||
var getGamepads = navigator.getGamepads || navigator.webkitGetGamepads;
|
||||
if(getGamepads){
|
||||
function runAnimation()
|
||||
{
|
||||
requestAnimationFrame.call(window, runAnimation);
|
||||
|
||||
var gamepads: GamepadList = getGamepads.call(navigator);
|
||||
for(var i = 0; i < gamepads.length; i++){
|
||||
var pad: Gamepad = gamepads[i];
|
||||
if(pad){
|
||||
for (var k = 0; k < pad.buttons.length; k++)
|
||||
{
|
||||
var button = pad.buttons[k];
|
||||
if(button !== 0){
|
||||
console.log('pad[' + pad.index + ']: ' + 'time=' + pad.timestamp + ' id="' + pad.id + '" button[' + k + '] = ' + button);
|
||||
}
|
||||
}
|
||||
for (var k = 0; k < pad.axes.length; k++)
|
||||
{
|
||||
var axis = pad.axes[k];
|
||||
if(Math.abs(axis) > 0.1){
|
||||
console.log('pad[' + pad.index + ']: ' + 'time=' + pad.timestamp + ' id="' + pad.id + '" axis[' + k + '] = ' + axis);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
runAnimation();
|
||||
}
|
||||
}();
|
||||
Vendored
+78
@@ -0,0 +1,78 @@
|
||||
// Type definitions for Gamepad API
|
||||
// Project: http://www.w3.org/TR/gamepad/
|
||||
// Definitions by: Kon <http://phyzkit.net/>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
/**
|
||||
* This interface defines an individual gamepad device.
|
||||
*/
|
||||
interface Gamepad{
|
||||
/**
|
||||
* An identification string for the gamepad. This string identifies the brand or style of connected gamepad device. Typically, this will include the USB vendor and a product ID.
|
||||
* @readonly
|
||||
*/
|
||||
id:string;
|
||||
|
||||
/**
|
||||
* The index of the gamepad in the Navigator. When multiple gamepads are connected to a user agent, indices must be assigned on a first-come, first-serve basis, starting at zero. If a gamepad is disconnected, previously assigned indices must not be reassigned to gamepads that continue to be connected. However, if a gamepad is disconnected, and subsequently the same or a different gamepad is then connected, index entries must be reused.
|
||||
* @readonly
|
||||
*/
|
||||
index:number;
|
||||
|
||||
/**
|
||||
* Last time the data for this gamepad was updated. Timestamp is a monotonically increasing value that allows the author to determine if the axes and button data have been updated from the hardware, relative to a previously saved timestamp.
|
||||
* @readonly
|
||||
*/
|
||||
timestamp:number;
|
||||
|
||||
/**
|
||||
* Array of values for all axes of the gamepad. All axis values must be linearly normalized to the range [-1.0 .. 1.0]. As appropriate, -1.0 should correspond to "up" or "left", and 1.0 should correspond to "down" or "right". Axes that are drawn from a 2D input device should appear next to each other in the axes array, X then Y. It is recommended that axes appear in decreasing order of importance, such that element 0 and 1 typically represent the X and Y axis of a directional stick.
|
||||
* @readonly
|
||||
*/
|
||||
axes:number[];
|
||||
|
||||
/**
|
||||
* Array of values for all buttons of the gamepad. All button values must be linearly normalized to the range [0.0 .. 1.0]. 0.0 must mean fully unpressed, and 1.0 must mean fully pressed. It is recommended that buttons appear in decreasing importance such that the primary button, secondary button, tertiary button, and so on appear as elements 0, 1, 2, ... in the buttons array.
|
||||
* @readonly
|
||||
*/
|
||||
buttons:number[];
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
interface GamepadEvent extends Event{
|
||||
/**
|
||||
* The single gamepad attribute provides access to the associated gamepad data for this event.
|
||||
* @readonly
|
||||
*/
|
||||
gamepad:Gamepad;
|
||||
}
|
||||
|
||||
interface GamepadList{
|
||||
[index: number]: Gamepad;
|
||||
length: number;
|
||||
}
|
||||
|
||||
interface Navigator{
|
||||
/**
|
||||
* The currently connected and interacted-with gamepads. Gamepads must only appear in the list if they are currently connected to the user agent, and have been interacted with by the user. Otherwise, they must not appear in the list to avoid a malicious page from fingerprinting the user based on connected devices.
|
||||
* @readonly
|
||||
*/
|
||||
getGamepads(): Gamepad[];
|
||||
|
||||
webkitGetGamepads(): GamepadList;
|
||||
|
||||
// Not supported yet :(
|
||||
// mozGetGamepads(): Gamepad[];
|
||||
}
|
||||
|
||||
/*
|
||||
* @event gamepadconnected
|
||||
* A user agent must dispatch this event type to indicate the user has connected a gamepad. If a gamepad was already connected when the page was loaded, the gamepadconnected event will be dispatched when the user presses a button or moves an axis.
|
||||
*/
|
||||
|
||||
/*
|
||||
* @event gamepaddisconnected
|
||||
* When a gamepad is disconnected from the user agent, if the user agent has previously dispatched a gamepadconnected event, a gamepaddisconnected event must be dispatched.
|
||||
*/
|
||||
@@ -0,0 +1,18 @@
|
||||
// Test files for Geolocation Definition file
|
||||
/// <reference path="google.geolocation.d.ts" />
|
||||
|
||||
//determine if the handset has client side geo location capabilities
|
||||
var isInit: bool = geo_position_js.init();
|
||||
if(isInit){
|
||||
geo_position_js.getCurrentPosition(success_callback, error_callback);
|
||||
} else {
|
||||
alert("Functionality not available");
|
||||
}
|
||||
|
||||
function success_callback(position: Position): void {
|
||||
geo_position_js.showMap(position.coords.latitude, position.coords.longitude);
|
||||
}
|
||||
|
||||
function error_callback(positionError: PositionError): void {
|
||||
console.log(positionError.code);
|
||||
}
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
// Type definitions for Google Geolocation 0.4.8
|
||||
// Project: https://code.google.com/p/geo-location-javascript/
|
||||
// Definitions by: Vincent Bortone <https://github.com/vbortone/>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
interface GeolocationStatic {
|
||||
init(): bool;
|
||||
getCurrentPosition(success: (position: Position) => void, error?: (positionError: PositionError) => void, opts?: PositionOptions): void;
|
||||
showMap(latitude: number, longitude: number): void;
|
||||
}
|
||||
|
||||
declare var geo_position_js: GeolocationStatic;
|
||||
Vendored
+1
-1
@@ -1123,7 +1123,7 @@ declare module google.maps {
|
||||
worldSize?: Size;
|
||||
}
|
||||
|
||||
export interface StreetViewService {
|
||||
export class StreetViewService {
|
||||
getPanoramaById(pano: string, callback: (streetViewPanoramaData: StreetViewPanoramaData, streetViewStatus: StreetViewStatus) => void );
|
||||
getPanoramaByLocation(latlng: LatLng, radius: number, callback: (streetViewPanoramaData: StreetViewPanoramaData, streetViewStatus: StreetViewStatus) => void );
|
||||
}
|
||||
|
||||
Vendored
+2
-1
@@ -7,7 +7,8 @@
|
||||
declare function describe(description: string, specDefinitions: Function): void;
|
||||
declare function xdescribe(description: string, specDefinitions: Function): void;
|
||||
|
||||
declare function it(expectation: string, assertion: Function): void;
|
||||
declare function it(expectation: string, assertion: () => void ): void;
|
||||
declare function it(expectation: string, assertion: (done: (err?) => void) => void ): void;
|
||||
declare function xit(expectation: string, assertion: Function): void;
|
||||
|
||||
declare function beforeEach(action: Function): void;
|
||||
|
||||
Vendored
+314
@@ -0,0 +1,314 @@
|
||||
// Type definitions for eLang 0.5.1
|
||||
// Project: https://github.com/sumegizoltan/ELang/
|
||||
// Definitions by: Zoltan Sumegi <https://github.com/sumegizoltan/>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
/// <reference path="../jquery/jquery.d.ts" />
|
||||
|
||||
interface IPageResource {
|
||||
lang?: IPageLangItems;
|
||||
selectedLang?: string;
|
||||
}
|
||||
|
||||
interface IPageLangItems {
|
||||
en?: IPageLabels;
|
||||
hu?: IPageLabels;
|
||||
}
|
||||
|
||||
interface IPageLabels {
|
||||
lblTitle?: string;
|
||||
lblPageHeader?: string;
|
||||
lblSearchField?: string;
|
||||
lblEditKeyField?: string;
|
||||
lblEditValueField?: string;
|
||||
lblFindedExpressionsHead?: string;
|
||||
lblEditedExpressionsHead?: string;
|
||||
lblFindHead?: string;
|
||||
lblEditHead?: string;
|
||||
lblFind?: string;
|
||||
lblAdd?: string;
|
||||
lblModify?: string;
|
||||
lblRemove?: string;
|
||||
lblSearchInExpressions?: string;
|
||||
lblSearchInMeanings?: string;
|
||||
lblSearchInExpressionsHlp?: string;
|
||||
lblSearchInMeaningsHlp?: string;
|
||||
lblTestHead?: string;
|
||||
lblOrderedTest?: string;
|
||||
lblRandomlyTest?: string;
|
||||
lblTypedTest?: string;
|
||||
lblSelectedTest?: string;
|
||||
lblWrittedTest?: string;
|
||||
lblVoicedTest?: string;
|
||||
lblStartTest?: string;
|
||||
lblStopTest?: string;
|
||||
lblTypedTestHlp?: string;
|
||||
lblSelectedTestHlp?: string;
|
||||
lblOrderedTestHlp?: string;
|
||||
lblRandomlyTestHlp?: string;
|
||||
lblWrittedTestHlp?: string;
|
||||
lblVoicedTestHlp?: string;
|
||||
}
|
||||
|
||||
interface ELangCommonStatic {
|
||||
resource: IPageResource;
|
||||
getLabel(labelid: string, langid?: string): string;
|
||||
setLang(langid: string, node?: JQuery): void;
|
||||
}
|
||||
|
||||
// ELang database (LocalStorage) functionality with Singleton instance
|
||||
|
||||
interface IELangDBOptions {
|
||||
autocompleteRows: number;
|
||||
}
|
||||
|
||||
interface IELangDBDelegates {
|
||||
selectHandler: Function;
|
||||
insertHandler: Function;
|
||||
modifyHandler: Function;
|
||||
removeHandler: Function;
|
||||
}
|
||||
|
||||
interface IELangDBEvents {
|
||||
select: JQueryDeferred;
|
||||
insert: JQueryDeferred;
|
||||
modify: JQueryDeferred;
|
||||
remove: JQueryDeferred;
|
||||
}
|
||||
|
||||
interface IELangDB {
|
||||
cache?: any;
|
||||
delegates?: IELangDBDelegates;
|
||||
events?: IELangDBEvents;
|
||||
isInitialized?: bool;
|
||||
options?: IELangDBOptions;
|
||||
|
||||
name?: string;
|
||||
description?: string;
|
||||
|
||||
initialize(options?: IELangDBOptions): void;
|
||||
|
||||
_onSelect(id: string, callback?: Function): void;
|
||||
_onInsert(id: string, value: string, callback?: Function): void;
|
||||
_onModify(id: string, value: string, callback?: Function): void;
|
||||
_onRemove(id: string, callback?: Function): void;
|
||||
|
||||
select(id: string, callback?: Function): void;
|
||||
insert(id: string, value: string, callback?: Function): void;
|
||||
modify(id: string, value: string, callback?: Function): void;
|
||||
remove(id: string, callback?: Function): void;
|
||||
|
||||
sort(): void;
|
||||
setOptions(options: IELangDBOptions): void;
|
||||
getIndexHash(id: string): string;
|
||||
getOptions(): IELangDBOptions;
|
||||
}
|
||||
|
||||
interface ELangStatic {
|
||||
getInstance(options?: IELangDBOptions): IELangDB;
|
||||
}
|
||||
|
||||
// ELangBase
|
||||
|
||||
interface IELangBaseDefaults {
|
||||
contentCSS: string;
|
||||
contentInnerCSS: string;
|
||||
resultCSS: string;
|
||||
resultHeadCSS: string;
|
||||
contentInnerHtml: string;
|
||||
fluidRowHtml: string;
|
||||
radioGroupHtml: string;
|
||||
radioButtonHtml: string;
|
||||
submitButtonHtml: string;
|
||||
headLabelHtml: string;
|
||||
resultHeadLabelHtml: string;
|
||||
resultHtml: string;
|
||||
headLabel: string;
|
||||
resultHeadLabel: string;
|
||||
}
|
||||
|
||||
interface IELangBase {
|
||||
name: string;
|
||||
description: string;
|
||||
delegates: any;
|
||||
element: JQuery;
|
||||
events: any;
|
||||
options: any;
|
||||
defaults: IELangBaseDefaults;
|
||||
|
||||
initialize(target: HTMLElement, options: any): void;
|
||||
|
||||
createContent(): void;
|
||||
|
||||
createRadioGroup(node: JQuery,
|
||||
isMethodAppend: bool,
|
||||
buttonNumber: number,
|
||||
defaultButton: number,
|
||||
btnLabels: string[],
|
||||
clickHandler: Function,
|
||||
btnTooltips?: string[]): void;
|
||||
appendAsLastChild(node: JQuery, element: JQuery): JQuery;
|
||||
getLastChild(node: JQuery): JQuery;
|
||||
isRdoChecked(eSrc: HTMLElement, rdoId: string): bool;
|
||||
processCommand(command: string): JQuery;
|
||||
setOptions(options: any): void;
|
||||
}
|
||||
|
||||
// ELangSearch
|
||||
|
||||
interface IELangSearchDefaults extends IELangBaseDefaults {
|
||||
expressionsLabel: string;
|
||||
expressionsTooltip: string;
|
||||
meaningsLabel: string;
|
||||
meaningsTooltip: string;
|
||||
searchFormHtml: string;
|
||||
searchFieldHtml: string;
|
||||
searchButtonLabel: string;
|
||||
}
|
||||
|
||||
interface IELangSearchDelegates {
|
||||
selectHandler: Function;
|
||||
selectCallback: Function;
|
||||
langDirectionHandler: Function;
|
||||
langDirectionClickHandler: Function;
|
||||
searchHandler: Function;
|
||||
searchClickHandler: Function;
|
||||
}
|
||||
|
||||
interface IELangSearchEvents {
|
||||
select: JQueryDeferred;
|
||||
}
|
||||
|
||||
interface IELangSearch extends IELangBase {
|
||||
defaults: IELangSearchDefaults;
|
||||
delegates: IELangSearchDelegates;
|
||||
events: IELangSearchEvents;
|
||||
isSearchInExp: bool;
|
||||
|
||||
initialize(target: HTMLElement, options: any): void;
|
||||
createContent(): void;
|
||||
|
||||
_onDirectionClick(eSrc: HTMLElement): void;
|
||||
_onSelect(eSrc: HTMLInputElement): void;
|
||||
_onSelectCallback(): void;
|
||||
|
||||
_select(eSrc: HTMLInputElement): void;
|
||||
}
|
||||
|
||||
// ELangEdit
|
||||
|
||||
interface IELangEditDelegates {
|
||||
insertHandler: Function;
|
||||
modifyHandler: Function;
|
||||
removeHandler: Function;
|
||||
selectHandler: Function;
|
||||
btnAddHandler: Function;
|
||||
btnAddClickHandler: Function;
|
||||
|
||||
insertCallback: Function;
|
||||
modifyCallback: Function;
|
||||
removeCallback: Function;
|
||||
selectCallback: Function;
|
||||
}
|
||||
|
||||
interface IELangEditEvents {
|
||||
insert: JQueryDeferred;
|
||||
modify: JQueryDeferred;
|
||||
remove: JQueryDeferred;
|
||||
select: JQueryDeferred;
|
||||
}
|
||||
|
||||
interface IELangEditDefaults extends IELangBaseDefaults {
|
||||
editFormHtml: string;
|
||||
editFieldHtml: string;
|
||||
addButtonHtml: string;
|
||||
addButtonLabel: string;
|
||||
editKeyLabel: string;
|
||||
editValueLabel: string;
|
||||
}
|
||||
|
||||
interface IELangEdit extends IELangBase {
|
||||
defaults: IELangEditDefaults;
|
||||
delegates: IELangEditDelegates;
|
||||
events: IELangEditEvents;
|
||||
|
||||
initialize(target: HTMLElement, options: any): void;
|
||||
createContent(): void;
|
||||
|
||||
_onAddClick(key: HTMLInputElement, value: HTMLInputElement): void;
|
||||
_onInsert(): void;
|
||||
_onInsertCallback(): void;
|
||||
_onModify(): void;
|
||||
_onModifyCallback(): void;
|
||||
_onRemove(): void;
|
||||
_onRemoveCallback(): void;
|
||||
_onSelect(): void;
|
||||
_onSelectCallback(): void;
|
||||
|
||||
|
||||
_insert(): void;
|
||||
_modify(): void;
|
||||
_remove(): void;
|
||||
_select(): void;
|
||||
}
|
||||
|
||||
// ELangTest
|
||||
|
||||
interface IELangTestDefaults extends IELangBaseDefaults {
|
||||
formHtml: string;
|
||||
startButtonLabel: string;
|
||||
stopButtonLabel: string;
|
||||
rdoTypedLabel: string;
|
||||
rdoSelectedLabel: string;
|
||||
rdoOrderedLabel: string;
|
||||
rdoRandomlyLabel: string;
|
||||
rdoWrittedLabel: string;
|
||||
rdoVoicedLabel: string;
|
||||
rdoTypedTooltip: string;
|
||||
rdoSelectedTooltip: string;
|
||||
rdoOrderedTooltip: string;
|
||||
rdoRandomlyTooltip: string;
|
||||
rdoWrittedTooltip: string;
|
||||
rdoVoicedTooltip: string;
|
||||
}
|
||||
|
||||
interface IELangTestDelegates {
|
||||
startStopHandler: Function;
|
||||
|
||||
rdoVariantHandler: Function;
|
||||
rdoModeHandler: Function;
|
||||
rdoQuestionHandler: Function;
|
||||
|
||||
rdoVariantClickHandler: Function;
|
||||
rdoModeClickHandler: Function;
|
||||
rdoQuestionClickHandler: Function;
|
||||
}
|
||||
|
||||
interface IELangTest extends IELangBase {
|
||||
defaults: IELangTestDefaults;
|
||||
delegates: IELangTestDelegates;
|
||||
|
||||
initialize(target: HTMLElement, options: any): void;
|
||||
createContent(): void;
|
||||
|
||||
_onRdoVariantClick(eSrc: HTMLElement): void;
|
||||
_onRdoModeClick(eSrc: HTMLElement): void;
|
||||
_onRdoQuestionClick(eSrc: HTMLElement): void;
|
||||
_onStartStopClick(): void;
|
||||
}
|
||||
|
||||
// interfaces for jQuery.fn.__plugin
|
||||
|
||||
interface IFnNewInstance {
|
||||
createInstance(el: HTMLElement,
|
||||
options: any,
|
||||
pluginName: string): JQuery;
|
||||
}
|
||||
|
||||
interface IFnJQuery {
|
||||
fnPlugin(context: JQuery,
|
||||
options: any,
|
||||
command: string,
|
||||
pluginName: string,
|
||||
pluginDataAttribute: string): JQuery;
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
// Tests for Livestamp.js type definitions
|
||||
/// <reference path="../jquery/jquery.d.ts"/>
|
||||
/// <reference path="../moment/moment.d.ts"/>
|
||||
/// <reference path="jquery.livestampjs.d.ts"/>
|
||||
|
||||
$('#test1').livestamp(new Date('June 18, 1987'));
|
||||
$('#test2').livestamp(1362282933);
|
||||
$('#test3').livestamp('destroy');
|
||||
$('#test4').livestamp(moment(new Date('June 18, 1987')));
|
||||
|
||||
$.livestamp.update();
|
||||
$.livestamp.pause();
|
||||
$.livestamp.resume();
|
||||
$.livestamp.interval(340);
|
||||
var result:number = $.livestamp.interval();
|
||||
+27
@@ -0,0 +1,27 @@
|
||||
// Type definitions for Livestamp.js
|
||||
// A simple, unobtrusive jQuery plugin that provides auto-updating timeago text to your timestamped HTML elements using Moment.js.
|
||||
// Project: http://http://mattbradley.github.com/livestampjs/
|
||||
// Definitions by: Vincent Bortone <https://github.com/vbortone/>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
/// <reference path="../jquery/jquery.d.ts"/>
|
||||
/// <reference path="../moment/moment.d.ts"/>
|
||||
|
||||
interface LivestampGlobal {
|
||||
update(): void;
|
||||
pause(): void;
|
||||
resume(): void;
|
||||
interval(): number;
|
||||
interval(interval: number): void;
|
||||
}
|
||||
|
||||
interface JQueryStatic {
|
||||
livestamp: LivestampGlobal;
|
||||
}
|
||||
|
||||
interface JQuery {
|
||||
livestamp(date: Date): JQuery;
|
||||
livestamp(moment: Moment): JQuery;
|
||||
livestamp(timestamp: number): JQuery;
|
||||
livestamp(timestamp: string): JQuery;
|
||||
}
|
||||
Vendored
+1
-1
@@ -714,7 +714,7 @@ interface JQuery {
|
||||
***********/
|
||||
length: number;
|
||||
selector: string;
|
||||
[x: string]: HTMLElement;
|
||||
[x: string]: any;
|
||||
[x: number]: HTMLElement;
|
||||
|
||||
/**********
|
||||
|
||||
@@ -0,0 +1,858 @@
|
||||
/// <reference path="../jquery/jquery.d.ts"/>
|
||||
/// <reference path="jsdeferred.d.ts"/>
|
||||
|
||||
declare function alert(a:any):void;
|
||||
declare function log(a:any):void;
|
||||
|
||||
interface DeferredizedJQueryStatic extends JQueryStatic {
|
||||
get(url:string, data?:any, success?:any, dataType?:any): Deferred;
|
||||
}
|
||||
declare var $: DeferredizedJQueryStatic;
|
||||
|
||||
declare interface http {
|
||||
get(url:string):Deferred;
|
||||
}
|
||||
|
||||
|
||||
/***** jsDoc case *****/
|
||||
|
||||
// constructor
|
||||
(()=> {
|
||||
var d = new Deferred();
|
||||
var d = Deferred();
|
||||
})();
|
||||
|
||||
// define
|
||||
(()=> {
|
||||
Deferred.define();
|
||||
$.get("/hoge").next(function (data) {
|
||||
alert(data);
|
||||
}).
|
||||
parallel([$.get("foo.html"), $.get("bar.html")]).next(function (values) {
|
||||
log($.map(values, function (v) { return v.length }));
|
||||
if (values[1].match(/nextUrl:\s*(\S+)/)) {
|
||||
return $.get(RegExp.$1).next(function (d) {
|
||||
return d;
|
||||
});
|
||||
}
|
||||
}).
|
||||
next(function (d) {
|
||||
log(d.length);
|
||||
});
|
||||
})();
|
||||
|
||||
// next
|
||||
(()=> {
|
||||
var d = new Deferred();
|
||||
d.
|
||||
next(function () {
|
||||
alert(1);
|
||||
}).
|
||||
next(function () {
|
||||
alert(2);
|
||||
});
|
||||
d.call();
|
||||
})();
|
||||
|
||||
// error
|
||||
(()=> {
|
||||
var d = new Deferred();
|
||||
d.
|
||||
next(function () {
|
||||
alert(1);
|
||||
throw "foo";
|
||||
}).
|
||||
next(function () {
|
||||
alert('not shown');
|
||||
}).
|
||||
error(function (e) {
|
||||
alert(e); //=> "foo"
|
||||
});
|
||||
d.call();
|
||||
})();
|
||||
|
||||
// call
|
||||
(()=> {
|
||||
var d = new Deferred();
|
||||
setTimeout(function () {
|
||||
d.call('value');
|
||||
}, 100);
|
||||
return d;
|
||||
})();
|
||||
|
||||
// fail
|
||||
(()=> {
|
||||
var d = new Deferred();
|
||||
var x = new XMLHttpRequest();
|
||||
x.onreadystatechange = function () {
|
||||
if (x.readyState == 4) {
|
||||
if (x.status == 200) d.call(x); else d.fail(x);
|
||||
}
|
||||
};
|
||||
return d;
|
||||
})();
|
||||
|
||||
// chain
|
||||
(()=> {
|
||||
chain(
|
||||
function () {
|
||||
return wait(0.5);
|
||||
},
|
||||
function (w) {
|
||||
throw "foo";
|
||||
},
|
||||
function error(e) {
|
||||
alert(e);
|
||||
},
|
||||
[
|
||||
function () {
|
||||
return wait(1);
|
||||
},
|
||||
function () {
|
||||
return wait(2);
|
||||
}
|
||||
],
|
||||
function (result) {
|
||||
alert([ result[0], result[1] ]);
|
||||
},
|
||||
{
|
||||
foo: wait(1),
|
||||
bar: wait(1)
|
||||
},
|
||||
function (result) {
|
||||
alert([ result.foo, result.bar ]);
|
||||
},
|
||||
function error(e) {
|
||||
alert(e);
|
||||
}
|
||||
);
|
||||
})();
|
||||
|
||||
// wait
|
||||
(()=> {
|
||||
wait(1).next(function (elapsed) {
|
||||
log(elapsed); //=> may be 990-1100
|
||||
});
|
||||
})();
|
||||
|
||||
// call
|
||||
(()=> {
|
||||
next(function () {
|
||||
function pow(x, n) {
|
||||
function _pow(n, r) {
|
||||
print([n, r]);
|
||||
if (n == 0) return r;
|
||||
return call(_pow, n - 1, x * r);
|
||||
}
|
||||
|
||||
return call(_pow, n, 1);
|
||||
}
|
||||
|
||||
return call(pow, 2, 10);
|
||||
}).
|
||||
next(function (r) {
|
||||
print([r, "end"]);
|
||||
});
|
||||
})();
|
||||
|
||||
// parallel
|
||||
(()=> {
|
||||
parallel([
|
||||
$.get("foo.html"),
|
||||
$.get("bar.html")
|
||||
]).next(function (values) {
|
||||
values[0] //=> foo.html data
|
||||
values[1] //=> bar.html data
|
||||
});
|
||||
|
||||
parallel({
|
||||
foo: $.get("foo.html"),
|
||||
bar: $.get("bar.html")
|
||||
}).next(function (values) {
|
||||
values.foo //=> foo.html data
|
||||
values.bar //=> bar.html data
|
||||
});
|
||||
})();
|
||||
|
||||
// loop
|
||||
(()=> {
|
||||
//=> loop 1 to 100
|
||||
loop({begin: 1, end: 100, step: 10}, function (n, o) {
|
||||
for (var i = 0; i < o.step; i++) {
|
||||
log(n + i);
|
||||
}
|
||||
});
|
||||
|
||||
//=> loop 10 times with sleeping 1 sec in each loop.
|
||||
loop(10, function (n) {
|
||||
log(n);
|
||||
return wait(1);
|
||||
});
|
||||
})();
|
||||
|
||||
// repeat
|
||||
(()=> {
|
||||
repeat(10, function (i) {
|
||||
i //=> 0,1,2,3,4,5,6,7,8,9
|
||||
});
|
||||
})();
|
||||
|
||||
// register
|
||||
(()=> {
|
||||
// Deferred.register("loop", loop);
|
||||
|
||||
// Global Deferred function
|
||||
loop(10,function (n) {
|
||||
print(n);
|
||||
}).
|
||||
// Registered Deferred.prototype.loop
|
||||
loop(10, function (n) {
|
||||
print(n);
|
||||
});
|
||||
})();
|
||||
|
||||
// connect
|
||||
(()=> {
|
||||
var timeout = Deferred.connect(setTimeout, { target: window, ok: 0 });
|
||||
timeout(1).next(function () {
|
||||
alert('after 1 sec');
|
||||
});
|
||||
|
||||
var timeout = Deferred.connect(window, "setTimeout");
|
||||
timeout(1).next(function () {
|
||||
alert('after 1 sec');
|
||||
});
|
||||
})();
|
||||
|
||||
// retry
|
||||
(()=> {
|
||||
Deferred.retry(3,function () {
|
||||
return http.get('foo.html');
|
||||
}).
|
||||
next(function (res) {
|
||||
res //=> response if succeeded
|
||||
}).
|
||||
error(function (e) {
|
||||
e //=> error if all try failed
|
||||
});
|
||||
})();
|
||||
|
||||
|
||||
/***** Tutorial case *****/
|
||||
|
||||
(()=> {
|
||||
Deferred.define();
|
||||
|
||||
next(function () {
|
||||
alert("Hello!");
|
||||
return wait(5);
|
||||
}).
|
||||
next(function () {
|
||||
alert("World!");
|
||||
});
|
||||
|
||||
Deferred.next(function () {
|
||||
alert("Hello!");
|
||||
return Deferred.wait(5);
|
||||
}).
|
||||
next(function () {
|
||||
alert("World!");
|
||||
});
|
||||
|
||||
// http.get is assumed to be a function that takes a URI as an argument and returns a Deferred instance
|
||||
var results = [];
|
||||
next(function () {
|
||||
return http.get("/foo.json").next(function (data) {
|
||||
results.push(data);
|
||||
});
|
||||
}).
|
||||
next(function () {
|
||||
return http.get("/baz.json").next(function (data) {
|
||||
results.push(data);
|
||||
});
|
||||
}).
|
||||
next(function () {
|
||||
return http.get("/baz.json").next(function (data) {
|
||||
results.push(data);
|
||||
});
|
||||
}).
|
||||
next(function () {
|
||||
alert(results);
|
||||
});
|
||||
|
||||
var wants = ["/foo.json", "/bar.json", "/baz.json"];
|
||||
var results = [];
|
||||
loop(wants.length,function (i) {
|
||||
return http.get(wants[i]).next(function (data) {
|
||||
results.push(data);
|
||||
});
|
||||
}).
|
||||
next(function () {
|
||||
alert(results);
|
||||
});
|
||||
|
||||
parallel([
|
||||
http.get("/foo.json"),
|
||||
http.get("/bar.json"),
|
||||
http.get("/baz.json")
|
||||
]).
|
||||
next(function (results) {
|
||||
alert(results);
|
||||
});
|
||||
|
||||
next(function () {
|
||||
// something 1
|
||||
}).
|
||||
next(function () {
|
||||
// asynchronous process
|
||||
throw "error!";
|
||||
}).
|
||||
next(function () {
|
||||
// something 2 (not executed as an error occurs in the previous process)
|
||||
});
|
||||
|
||||
next(function () {
|
||||
// something 1
|
||||
}).
|
||||
next(function () {
|
||||
// asynchronous process
|
||||
throw "error!";
|
||||
}).
|
||||
next(function () {
|
||||
// something 2 (not executed as an error occurs in the previous process)
|
||||
}).
|
||||
error(function (e) {
|
||||
alert(e);
|
||||
});
|
||||
|
||||
next(function () {
|
||||
// something 1
|
||||
}).
|
||||
next(function () {
|
||||
// asynchronous process
|
||||
throw "error!";
|
||||
}).
|
||||
error(function (e) {
|
||||
alert(e);
|
||||
}).
|
||||
next(function () {
|
||||
// something 2 (executed since the exception would already be handled)
|
||||
}).
|
||||
error(function (e) {
|
||||
alert(e);
|
||||
});
|
||||
|
||||
next(function () {
|
||||
alert("Hello!");
|
||||
return wait(5);
|
||||
}).
|
||||
next(function () {
|
||||
alert("World!");
|
||||
});
|
||||
|
||||
next(function () {
|
||||
alert(1);
|
||||
return next(function () {
|
||||
alert(2);
|
||||
}).
|
||||
next(function () {
|
||||
alert(3);
|
||||
});
|
||||
}).
|
||||
next(function () {
|
||||
alert(4);
|
||||
});
|
||||
|
||||
var http = {}
|
||||
http.get = function (uri) {
|
||||
var deferred = new Deferred();
|
||||
var xhr = new XMLHttpRequest();
|
||||
xhr.onreadystatechange = function () {
|
||||
if (xhr.readyState == 4) {
|
||||
if (xhr.status == 200) {
|
||||
deferred.call(xhr);
|
||||
} else {
|
||||
deferred.fail(xhr);
|
||||
}
|
||||
}
|
||||
};
|
||||
deferred.canceller = function () { xhr.abort() };
|
||||
return deferred;
|
||||
}
|
||||
|
||||
loop(1000, function (n) {
|
||||
// heavy process
|
||||
});
|
||||
|
||||
function repeat(n, f) {
|
||||
var i = 0, end = {}, ret = null;
|
||||
return Deferred.next(function () {
|
||||
var t = (new Date()).getTime();
|
||||
divide: {
|
||||
do {
|
||||
if (i >= n) break divide;
|
||||
ret = f(i++);
|
||||
} while ((new Date()).getTime() - t < 20);
|
||||
return Deferred.call(arguments.callee);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
next(function () {
|
||||
console.log("start");
|
||||
}).
|
||||
next(function () {
|
||||
function pow(x, n) {
|
||||
function _pow(n, r) {
|
||||
console.log([n, r]);
|
||||
if (n == 0) return r;
|
||||
return call(_pow, n - 1, x * r);
|
||||
}
|
||||
|
||||
return call(_pow, n, 1);
|
||||
}
|
||||
|
||||
return call(pow, 2, 10);
|
||||
}).
|
||||
next(function (r) {
|
||||
console.log([r, "end"]);
|
||||
}).
|
||||
error(function (e) {
|
||||
alert(e);
|
||||
})
|
||||
|
||||
loop(10, function (i) {
|
||||
console.log(i)
|
||||
});
|
||||
|
||||
$.get("README.markdown").next(function (data) {
|
||||
console.log(data);
|
||||
});
|
||||
|
||||
})();
|
||||
|
||||
(()=> {
|
||||
console.log("start. gathering data.");
|
||||
|
||||
parallel([$.get("README.markdown"), $.get("ChangeLog")]).
|
||||
next(function (values) {
|
||||
var lengths = $.map(values, function (i) { return i.length });
|
||||
console.log(lengths.join(", "));
|
||||
});
|
||||
})();
|
||||
|
||||
(()=> {
|
||||
console.log("start. gathering data.");
|
||||
|
||||
parallel({html: $.get("README.markdown"), js: $.get("ChangeLog")}).
|
||||
next(function (values) {
|
||||
console.log(["html=", values.html.length, " js=", values.js.length].join(""));
|
||||
});
|
||||
})();
|
||||
|
||||
(()=> {
|
||||
console.log("start. wait 3 sec.");
|
||||
|
||||
var list = [];
|
||||
var printAndReturn = function (i) {
|
||||
console.log(i + "msec elapsed");
|
||||
return i;
|
||||
};
|
||||
list.push(wait(0).next(printAndReturn));
|
||||
list.push(wait(1).next(printAndReturn));
|
||||
list.push(wait(2).next(printAndReturn));
|
||||
list.push(wait(3).next(printAndReturn));
|
||||
|
||||
parallel(list).next(function (values) {
|
||||
console.log("Completed. values: " + values.join(", "));
|
||||
});
|
||||
})();
|
||||
|
||||
(()=> {
|
||||
var queue = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
|
||||
var workers = new Array(2);
|
||||
var work = function (job) {
|
||||
console.log('working... ' + job);
|
||||
return wait(Math.random() * 4);
|
||||
};
|
||||
|
||||
for (var i = 0, len = workers.length; i < len; i++) {
|
||||
workers[i] = next(function me() {
|
||||
var job = queue.shift();
|
||||
if (!job) return;
|
||||
|
||||
console.log("start worker: " + job);
|
||||
return next(function () { return job }).
|
||||
next(work).
|
||||
next(me);
|
||||
}).
|
||||
error(function (e) {
|
||||
alert(e);
|
||||
});
|
||||
}
|
||||
|
||||
parallel(workers).next(function () {
|
||||
console.log('all done!');
|
||||
});
|
||||
})();
|
||||
|
||||
(()=> {
|
||||
next(function () {
|
||||
var sum = 0;
|
||||
return loop({end: 100000, step: 1000}, function (n, o) {
|
||||
console.log(["Processing divided loop:n=", n, ", sum=", sum, " last?=", o.last].join(""));
|
||||
for (var i = 0; i < o.step; i++) {
|
||||
// console.log(i + n);
|
||||
sum += i + n;
|
||||
}
|
||||
console.log(["sum=", sum].join(""));
|
||||
return sum;
|
||||
});
|
||||
}).
|
||||
next(function (e) {
|
||||
console.log("Result:" + e);
|
||||
console.log("end");
|
||||
}).
|
||||
error(function (e) {
|
||||
console.log(e);
|
||||
});
|
||||
})();
|
||||
|
||||
(()=> {
|
||||
loop({begin: 1, end: 100, step: 10}, function (n, o) {
|
||||
console.log(["Processing divided loop:n=", n, " last?=", o.last].join(""));
|
||||
for (var i = 0; i < o.step; i++) {
|
||||
var j = n + i;
|
||||
console.log(j);
|
||||
}
|
||||
});
|
||||
})();
|
||||
|
||||
(()=> {
|
||||
Deferred.repeat(100, function (n, o) {
|
||||
console.log(n);
|
||||
for (var i = 0; i < Math.pow(n, 2); i++) {
|
||||
for (var j = n; j; j--);
|
||||
}
|
||||
});
|
||||
})();
|
||||
|
||||
(()=> {
|
||||
loop(10, function (n) {
|
||||
console.log(n);
|
||||
return wait(0.1);
|
||||
});
|
||||
|
||||
loop(10, function (n) {
|
||||
console.log(String.fromCharCode(97 + n));
|
||||
return wait(0.2);
|
||||
});
|
||||
})();
|
||||
|
||||
(()=> {
|
||||
console.log(0);
|
||||
loop(10,function (n) {
|
||||
console.log(n);
|
||||
return n;
|
||||
}).
|
||||
wait(1).
|
||||
loop(10,function (n) {
|
||||
var c = String.fromCharCode(97 + n);
|
||||
console.log(c);
|
||||
return c;
|
||||
}).
|
||||
next(function (i) {
|
||||
console.log("end");
|
||||
}).
|
||||
error(function (e) {
|
||||
alert(e);
|
||||
});
|
||||
})();
|
||||
|
||||
(()=> {
|
||||
loop(5,function (i, o) {
|
||||
console.log(i);
|
||||
return o.last ? i : wait(1);
|
||||
}).
|
||||
next(function (e) {
|
||||
console.log("end [" + e + "]");
|
||||
}).
|
||||
error(function (e) {
|
||||
console.log(e);
|
||||
});
|
||||
})();
|
||||
|
||||
(()=> {
|
||||
next(function (i) {
|
||||
function delayloop(i) {
|
||||
console.log(i++);
|
||||
if (i < 5) {
|
||||
return wait(1).next(function () {
|
||||
return call(delayloop, i);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
return call(delayloop, 0);
|
||||
}).
|
||||
next(function (e) {
|
||||
console.log("end");
|
||||
}).
|
||||
error(function (e) {
|
||||
console.log(e);
|
||||
});
|
||||
})();
|
||||
|
||||
(()=> {
|
||||
function callcc(fun) {
|
||||
var error = new Deferred();
|
||||
return call(function () {
|
||||
// JSDeferred passes current Deferred Object to this.
|
||||
var ccdeferred = this;
|
||||
// Call with current continuation (calling Deferred.next)
|
||||
return fun(function (a) {
|
||||
ccdeferred._next.call(a);
|
||||
throw error
|
||||
});
|
||||
}).
|
||||
error(function (e) {
|
||||
// Current Deferred chain must be stopped
|
||||
if (e === error) {
|
||||
return e;
|
||||
} else {
|
||||
throw e;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
callcc(function (cont) {
|
||||
return 10 * 10 * cont(20);
|
||||
}).
|
||||
next(function (val) {
|
||||
console.log("callcc1 returns:" + val);
|
||||
});
|
||||
// should show "callcc1 returns:20"
|
||||
|
||||
var cont;
|
||||
var i = 0;
|
||||
callcc(function (c) {
|
||||
cont = c;
|
||||
return 10;
|
||||
}).
|
||||
next(function (val) {
|
||||
console.log("callcc2 returns:" + val);
|
||||
if (!i++) cont(20);
|
||||
});
|
||||
// should show "callcc2 returns:10", "callcc returns:20"
|
||||
})();
|
||||
|
||||
(()=> {
|
||||
function callcc(fun) {
|
||||
var error = new Deferred();
|
||||
return call(function () {
|
||||
// JSDeferred passes current Deferred Object to this.
|
||||
var ccdeferred = this;
|
||||
// Call with current continuation (calling Deferred.next)
|
||||
return fun(function (a) {
|
||||
ccdeferred._next.call(a);
|
||||
throw error
|
||||
});
|
||||
}).
|
||||
error(function (e) {
|
||||
// Current Deferred chain must be stopped
|
||||
if (e === error) {
|
||||
return e;
|
||||
} else {
|
||||
throw e;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// http://www.sampou.org/scheme/t-y-scheme/t-y-scheme-Z-H-16.html#node_chap_14
|
||||
// Just port above.
|
||||
function amb() {
|
||||
var alts = arguments;
|
||||
var prevAmbFail = amb.ambFail;
|
||||
|
||||
return callcc(function (sk) {
|
||||
return loop(alts.length,function (i) {
|
||||
var alt = alts[i];
|
||||
return callcc(function (fk) {
|
||||
amb.ambFail = function () {
|
||||
amb.ambFail = prevAmbFail;
|
||||
return fk("fail");
|
||||
};
|
||||
return sk(alt);
|
||||
});
|
||||
}).
|
||||
next(prevAmbFail);
|
||||
});
|
||||
}
|
||||
|
||||
amb.ambFail = function () { throw "amb tree exhausted" };
|
||||
|
||||
// Utility function
|
||||
function amb1(ambvars) {
|
||||
var f = wait(0);
|
||||
var vars = {};
|
||||
for (var k in ambvars) if (ambvars.hasOwnProperty(k)) (function (name, val) {
|
||||
console.log(name);
|
||||
f = f.next(function () {
|
||||
return amb.apply(this, val).next(function (i) {
|
||||
vars[name] = i;
|
||||
return vars;
|
||||
});
|
||||
});
|
||||
})(k, ambvars[k]);
|
||||
|
||||
return f;
|
||||
}
|
||||
|
||||
function assert(cond) {
|
||||
if (!cond) throw amb();
|
||||
}
|
||||
|
||||
// http://mayokara.info/note/view/251
|
||||
Array.prototype.uniq = function () {
|
||||
for (var i = 0, l = this.length; i < l; i++) {
|
||||
if (this.indexOf(this[i]) < i) {
|
||||
this.splice(i--, l-- && 1);
|
||||
}
|
||||
}
|
||||
return this;
|
||||
};
|
||||
|
||||
amb1({
|
||||
baker : [1, 2, 3, 4, 5],
|
||||
cooper : [1, 2, 3, 4, 5],
|
||||
fletcher: [1, 2, 3, 4, 5],
|
||||
miller : [1, 2, 3, 4, 5],
|
||||
smith : [1, 2, 3, 4, 5]
|
||||
}).
|
||||
next(function (vars) {
|
||||
with (vars) {
|
||||
console.log(vars);
|
||||
// 簡易 distinct
|
||||
assert([baker, cooper, fletcher, miller, smith].uniq().length == 5);
|
||||
console.log("distinct passed");
|
||||
assert(baker != 5);
|
||||
assert(cooper != 1);
|
||||
assert(fletcher != 1 && fletcher != 5);
|
||||
assert(miller > cooper);
|
||||
assert(Math.abs(smith - fletcher) != 1);
|
||||
assert(Math.abs(fletcher - cooper) != 1);
|
||||
|
||||
return vars;
|
||||
}
|
||||
}).
|
||||
next(function (vars) {
|
||||
with (vars) {
|
||||
console.log("solved");
|
||||
console.log(vars);
|
||||
alert(uneval(vars));
|
||||
}
|
||||
}).
|
||||
error(function (e) {
|
||||
alert(e)
|
||||
});
|
||||
})();
|
||||
|
||||
(()=> {
|
||||
var d1 = new Deferred();
|
||||
d1.callback.ok = function () {
|
||||
alert("1");
|
||||
};
|
||||
|
||||
var d2 = new Deferred();
|
||||
d2.callback.ok = function () {
|
||||
alert("2");
|
||||
};
|
||||
|
||||
// Set d2 as continuation of d1.
|
||||
d1._next = d2;
|
||||
|
||||
// Invoke the chain.
|
||||
d1.call();
|
||||
})();
|
||||
|
||||
(()=> {
|
||||
next(function () { // this `next` is global function
|
||||
alert("1");
|
||||
}).
|
||||
next(function () { // this `next` is Deferred#next
|
||||
alert("2");
|
||||
}).
|
||||
next(function () {
|
||||
alert("3");
|
||||
});
|
||||
})();
|
||||
|
||||
(()=> {
|
||||
next(function () {
|
||||
alert("1");
|
||||
}).
|
||||
next(function () {
|
||||
alert("2");
|
||||
// child Deferred
|
||||
return next(function () {
|
||||
alert("3");
|
||||
});
|
||||
}).
|
||||
next(function () {
|
||||
alert("4");
|
||||
});
|
||||
})();
|
||||
|
||||
(()=> {
|
||||
next(function () {
|
||||
alert("1");
|
||||
}).
|
||||
next(function () {
|
||||
alert("2");
|
||||
var d = next(function () {
|
||||
alert("3");
|
||||
});
|
||||
d._next = this._next;
|
||||
this.cancel();
|
||||
}).
|
||||
next(function () {
|
||||
alert("4");
|
||||
});
|
||||
})();
|
||||
|
||||
(()=> {
|
||||
next(function () {
|
||||
alert("1");
|
||||
}).
|
||||
next(function () {
|
||||
alert("2");
|
||||
next(function () {
|
||||
alert("3");
|
||||
}).
|
||||
next(function () {
|
||||
alert("4");
|
||||
});
|
||||
});
|
||||
})();
|
||||
|
||||
(()=> {
|
||||
next(function () {
|
||||
throw "Error";
|
||||
}).
|
||||
error(function (e) {
|
||||
expect("Errorback called", "Error", e);
|
||||
return e; // recovering error
|
||||
}).
|
||||
next(function (e) {
|
||||
expect("Callback called", "Error", e);
|
||||
throw "Error2";
|
||||
}).
|
||||
next(function (e) {
|
||||
// This process is not called because
|
||||
// the error is not recovered.
|
||||
ng("Must not be called!!");
|
||||
}).
|
||||
error(function (e) {
|
||||
expect("Errorback called", "Error2", e);
|
||||
});
|
||||
})();
|
||||
Vendored
+98
@@ -0,0 +1,98 @@
|
||||
// Type definitions for JSDeferred
|
||||
// Project: https://github.com/cho45/jsdeferred
|
||||
// Definitions by: Daisuke Mino <https://github.com/minodisk>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
interface Loop {
|
||||
begin:number;
|
||||
end:number;
|
||||
step:number;
|
||||
}
|
||||
|
||||
interface ConnectOption {
|
||||
target:any;
|
||||
args?:any[];
|
||||
ok?:number;
|
||||
ng?:number;
|
||||
}
|
||||
|
||||
interface RetryOption {
|
||||
wait:number;
|
||||
}
|
||||
|
||||
interface DeferredizedFunction { (...arg:any[]):Deferred; }
|
||||
interface DeferredizedFunctionWithNumber { (n:number):Deferred; }
|
||||
interface FunctionWithNumber { (i:number); }
|
||||
interface ErrorCallback { (d:Deferred, ...args:any[]); }
|
||||
|
||||
declare class Deferred {
|
||||
|
||||
static methods:string[];
|
||||
|
||||
static isDeferred(obj:any):bool;
|
||||
|
||||
static next(fun:Function):Deferred;
|
||||
|
||||
static chain(...args:any[]):Deferred;
|
||||
|
||||
static wait(n:number):Deferred;
|
||||
|
||||
static call(fun?:Function, ...args:any[]):Deferred;
|
||||
|
||||
static parallel(dl:any):Deferred;
|
||||
|
||||
static earlier(dl:any):Deferred;
|
||||
|
||||
static loop(n:number, fun:FunctionWithNumber):Deferred;
|
||||
|
||||
static loop(n:Loop, fun:FunctionWithNumber):Deferred;
|
||||
|
||||
static repeat(n:number, fun:FunctionWithNumber):Deferred;
|
||||
|
||||
static register(name:string, fun:DeferredizedFunction):void;
|
||||
|
||||
static connect(funo:any, options:string):DeferredizedFunction;
|
||||
|
||||
static connect(funo:Function, options?:ConnectOption):DeferredizedFunction;
|
||||
|
||||
static retry(retryCount:number, funcDeferred:DeferredizedFunctionWithNumber, options?:RetryOption):Deferred;
|
||||
|
||||
static define(obj?:any, list?:string[]):any;
|
||||
|
||||
constructor();
|
||||
|
||||
next(fun:Function):Deferred;
|
||||
|
||||
wait(n:number):Deferred;
|
||||
|
||||
error(fun:ErrorCallback):Deferred;
|
||||
|
||||
call(val?:any):Deferred;
|
||||
|
||||
fail(err:any):Deferred;
|
||||
|
||||
cancel():Deferred;
|
||||
|
||||
parallel(dl:any):Deferred;
|
||||
|
||||
loop(n:number, fun:FunctionWithNumber):Deferred;
|
||||
|
||||
loop(n:Loop, fun:FunctionWithNumber):Deferred;
|
||||
|
||||
}
|
||||
|
||||
|
||||
declare function chain(...args:any[]):Deferred;
|
||||
|
||||
declare function wait(n:number):Deferred;
|
||||
|
||||
declare function call(fun?:Function, ...args:any[]):Deferred;
|
||||
|
||||
declare function parallel(dl:any):Deferred;
|
||||
|
||||
declare function earlier(dl:any):Deferred;
|
||||
|
||||
declare function loop(n:number, fun:FunctionWithNumber):Deferred;
|
||||
declare function loop(n:Loop, fun:FunctionWithNumber):Deferred;
|
||||
|
||||
declare function repeat(n:number, fun:FunctionWithNumber):Deferred;
|
||||
Vendored
+533
-526
File diff suppressed because it is too large
Load Diff
Vendored
+36
-37
@@ -21,42 +21,42 @@ module createjs {
|
||||
close(): void;
|
||||
getItem(value: string): Object;
|
||||
load(): void;
|
||||
toString(): string;
|
||||
toString(): string;
|
||||
|
||||
// events
|
||||
complete: (event: Object) => any;
|
||||
error: (event: Object) => any;
|
||||
fileload: (event: Object) => any;
|
||||
fileprogress: (event: Object) => any;
|
||||
loadStart: (event: Object) => any;
|
||||
complete: (event: Object) => any;
|
||||
error: (event: Object) => any;
|
||||
fileload: (event: Object) => any;
|
||||
fileprogress: (event: Object) => any;
|
||||
loadStart: (event: Object) => any;
|
||||
|
||||
// EventDispatcher mixins
|
||||
addEventListener(type: string, listener: (eventObj: Object) => bool): Function;
|
||||
addEventListener(type: string, listener: (eventObj: Object) => bool): Object;
|
||||
removeEventListener(type: string, listener: (eventObj: Function) => bool): void;
|
||||
removeEventListener(type: string, listener: (eventObj: Object) => bool): void;
|
||||
removeAllEventListeners(type: string): void;
|
||||
dispatchEvent(eventObj: string, target: Object): bool;
|
||||
dispatchEvent(eventObj: Object, target: Object): bool;
|
||||
hasEventListener(type: string): bool;
|
||||
// EventDispatcher mixins
|
||||
addEventListener(type: string, listener: (eventObj: Object) => bool): Function;
|
||||
addEventListener(type: string, listener: (eventObj: Object) => bool): Object;
|
||||
removeEventListener(type: string, listener: (eventObj: Function) => bool): void;
|
||||
removeEventListener(type: string, listener: (eventObj: Object) => bool): void;
|
||||
removeAllEventListeners(type: string): void;
|
||||
dispatchEvent(eventObj: string, target: Object): bool;
|
||||
dispatchEvent(eventObj: Object, target: Object): bool;
|
||||
hasEventListener(type: string): bool;
|
||||
}
|
||||
|
||||
export class PreloadJS {
|
||||
version: string;
|
||||
buildDate: string;
|
||||
}
|
||||
export class PreloadJS {
|
||||
version: string;
|
||||
buildDate: string;
|
||||
}
|
||||
|
||||
export class LoadQueue extends AbstractLoader {
|
||||
constructor (useXHR?: bool);
|
||||
|
||||
// properties
|
||||
static BINARY: string;
|
||||
static BINARY: string;
|
||||
static CSS: string;
|
||||
static IMAGE: string;
|
||||
static JAVASCRIPT: string;
|
||||
static JSON: string;
|
||||
static SOUND: string;
|
||||
static SVG: string;
|
||||
static SVG: string;
|
||||
static TEXT: string;
|
||||
static LOAD_TIMEOUT: number;
|
||||
static XML: string;
|
||||
@@ -68,24 +68,23 @@ module createjs {
|
||||
|
||||
// methods
|
||||
BrowserDetect(): Object;
|
||||
init(useXHR?: bool): void;
|
||||
init(useXHR?: bool): void;
|
||||
close(): void;
|
||||
getResult(value: string): Object;
|
||||
initialize(useXHR: bool): void;
|
||||
installPlugin(plugin: () => any): void;
|
||||
load(): void;
|
||||
loadFile(file: Object, loadNow: bool): void;
|
||||
loadFile(file: string, loadNow: bool): void;
|
||||
loadManifest(manifest: Object[], loadNow: bool): void;
|
||||
loadManifest(manifest: string[], loadNow: bool): void;
|
||||
getItem(value: string): Object;
|
||||
getResult(value: string, rawResult?: bool): Object;
|
||||
removeAll(): void;
|
||||
remove(idsOrUrls: string): void;
|
||||
remove(idsOrUrls: Array): void;
|
||||
reset(): void;
|
||||
loadFile(file: Object, loadNow?: bool): void;
|
||||
loadFile(file: string, loadNow?: bool): void;
|
||||
loadManifest(manifest: Object[], loadNow?: bool): void;
|
||||
loadManifest(manifest: string[], loadNow?: bool): void;
|
||||
getItem(value: string): Object;
|
||||
getResult(value: string, rawResult?: bool): Object;
|
||||
removeAll(): void;
|
||||
remove(idsOrUrls: string): void;
|
||||
remove(idsOrUrls: Array): void;
|
||||
reset(): void;
|
||||
setMaxConnections(value: number): void;
|
||||
setUseXHR(value: bool): void;
|
||||
setUseXHR(value: bool): void;
|
||||
setPaused(value: bool): void;
|
||||
}
|
||||
|
||||
@@ -93,13 +92,13 @@ module createjs {
|
||||
export class TagLoader extends AbstractLoader {
|
||||
constructor (item: Object, srcAttr: string, useXHR: bool);
|
||||
constructor (item: string, srcAttr: string, useXHR: bool);
|
||||
getResult(): HTMLImageElement;
|
||||
getResult(): HTMLAudioElement;
|
||||
getResult(): HTMLImageElement;
|
||||
getResult(): HTMLAudioElement;
|
||||
}
|
||||
|
||||
|
||||
export class XHRLoader extends AbstractLoader {
|
||||
constructor (file: Object);
|
||||
getResult(rawResult?: bool);
|
||||
getResult(rawResult?: bool);
|
||||
}
|
||||
}
|
||||
|
||||
+23815
File diff suppressed because it is too large
Load Diff
Vendored
+227
-43
@@ -89,11 +89,14 @@ module THREE {
|
||||
|
||||
// Mapping modes
|
||||
export enum Mapping { }
|
||||
export var UVMapping: Mapping;
|
||||
export var CubeReflectionMapping: Mapping;
|
||||
export var CubeRefractionMapping: Mapping;
|
||||
export var SphericalReflectionMapping: Mapping;
|
||||
export var SphericalRefractionMapping: Mapping;
|
||||
export interface MappingConstructor {
|
||||
new(): Mapping;
|
||||
}
|
||||
export var UVMapping: MappingConstructor;
|
||||
export var CubeReflectionMapping: MappingConstructor;
|
||||
export var CubeRefractionMapping: MappingConstructor;
|
||||
export var SphericalReflectionMapping: MappingConstructor;
|
||||
export var SphericalRefractionMapping: MappingConstructor;
|
||||
|
||||
// Wrapping modes
|
||||
export enum Wrapping { }
|
||||
@@ -183,6 +186,24 @@ module THREE {
|
||||
|
||||
// Core ///////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
interface BufferGeometryAttributeArray extends ArrayBufferView{
|
||||
length: number;
|
||||
}
|
||||
|
||||
interface BufferGeometryAttribute{
|
||||
itemSize: number;
|
||||
array: BufferGeometryAttributeArray;
|
||||
numItems: number;
|
||||
}
|
||||
|
||||
interface BufferGeometryAttributes{
|
||||
[name: string]: BufferGeometryAttribute;
|
||||
index?: BufferGeometryAttribute;
|
||||
position?: BufferGeometryAttribute;
|
||||
normal?: BufferGeometryAttribute;
|
||||
color?: BufferGeometryAttribute;
|
||||
}
|
||||
|
||||
/**
|
||||
* This is a superefficent class for geometries because it saves all data in buffers.
|
||||
* It reduces memory costs and cpu cycles. But it is not as easy to work with because of all the nessecary buffer calculations.
|
||||
@@ -204,7 +225,7 @@ module THREE {
|
||||
/**
|
||||
* This hashmap has as id the name of the attribute to be set and as value the buffer to set it to.
|
||||
*/
|
||||
attributes: { [name: string]: any; };
|
||||
attributes: BufferGeometryAttributes;
|
||||
|
||||
/**
|
||||
* When set, it holds certain buffers in memory to have faster updates for this object. When unset, it deletes those buffers and saves memory.
|
||||
@@ -224,6 +245,8 @@ module THREE {
|
||||
hasTangents: bool;
|
||||
morphTargets: any[];
|
||||
|
||||
offsets: { start: number; count: number; index: number; }[];
|
||||
|
||||
/**
|
||||
* Bakes matrix transform directly into vertex coordinates.
|
||||
*/
|
||||
@@ -861,7 +884,7 @@ module THREE {
|
||||
* Frustums are used to determine what is inside the camera's field of view. They help speed up the rendering process.
|
||||
*/
|
||||
export class Frustum {
|
||||
constructor(p0?: number, p1?: number, p2?: number, p3?: number, p4?: number, p5?: number);
|
||||
constructor(p0?: Plane, p1?: Plane, p2?: Plane, p3?: Plane, p4?: Plane, p5?: Plane);
|
||||
|
||||
/**
|
||||
* Array of 6 vectors.
|
||||
@@ -884,13 +907,15 @@ module THREE {
|
||||
|
||||
export class Line3{
|
||||
constructor(start?:Vector3, end?:Vector3);
|
||||
start: Vector3;
|
||||
end: Vector3;
|
||||
set(start?:Vector3, end?:Vector3):Line3;
|
||||
copy(line:Line3):Line3;
|
||||
center(optionalTarget?:Vector3):Vector3;
|
||||
delta(optionalTarget?:Vector3):Vector3;
|
||||
distanceSq():number;
|
||||
distance():number;
|
||||
at(t:number, optionalTarget:Vector3):Vector3;
|
||||
at(t:number, optionalTarget?: Vector3):Vector3;
|
||||
closestPointToPointParameter(point:Vector3, clampToLine?:bool):number;
|
||||
closestPointToPoint(point:Vector3, clampToLine?:bool, optionalTarget?:Vector3):Vector3;
|
||||
applyMatrix4(matrix:Matrix4):Line3;
|
||||
@@ -913,9 +938,10 @@ module THREE {
|
||||
distanceToSphere(sphere: Sphere): number;
|
||||
projectPoint(point: Vector3, optionalTarget?: Vector3): Vector3;
|
||||
orthoPoint(point: Vector3, optionalTarget?: Vector3): Vector3;
|
||||
isIntersectionLine(startPoint: Vector3, endPoint: Vector3): bool;
|
||||
isIntersectionLine(line: Line3): bool;
|
||||
intersectLine(line: Line3, optionalTarget?: Vector3): Vector3;
|
||||
coplanarPoint(optionalTarget?: bool): Vector3;
|
||||
applyMatrix4(matrix: Matrix3, optionalNormalMatrix?: Matrix3): Plane;
|
||||
applyMatrix4(matrix: Matrix4, optionalNormalMatrix?: Matrix3): Plane;
|
||||
translate(offset: Vector3): Plane;
|
||||
equals(plane: Plane): bool;
|
||||
clone(): Plane;
|
||||
@@ -932,8 +958,8 @@ module THREE {
|
||||
containsPoint(point: Vector3): bool;
|
||||
distanceToPoint(point: Vector3): number;
|
||||
intersectsSphere(sphere: Sphere): bool;
|
||||
clampPoint(point: Vector3, optionalTarget?: Vector3): Sphere;
|
||||
getBoundingBox(optionalTarget: Box3): Box3;
|
||||
clampPoint(point: Vector3, optionalTarget?: Vector3): Vector3;
|
||||
getBoundingBox(optionalTarget?: Box3): Box3;
|
||||
applyMatrix4(matrix: Matrix): Sphere;
|
||||
translate(offset: Vector3): Sphere;
|
||||
equals(sphere: Sphere): bool;
|
||||
@@ -1247,6 +1273,10 @@ module THREE {
|
||||
* Returns -1 if x is less than 0, 1 if x is greater than 0, and 0 if x is zero.
|
||||
*/
|
||||
sign(x: number): number;
|
||||
|
||||
degToRad(degrees: number): number;
|
||||
|
||||
radToDeg(radians: number): number;
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -1325,6 +1355,7 @@ module THREE {
|
||||
multiplyScalar(s: number): Matrix3;
|
||||
determinant(): number;
|
||||
getInverse(matrix: Matrix3, throwOnInvertible?: bool): Matrix3;
|
||||
getInverse(matrix: Matrix4, throwOnInvertible?: bool): Matrix3;
|
||||
|
||||
/**
|
||||
* Transposes this matrix in place.
|
||||
@@ -1398,7 +1429,7 @@ module THREE {
|
||||
*
|
||||
* @param v Rotation vector. order — The order of rotations. Eg. "XYZ".
|
||||
*/
|
||||
setRotationFromEuler(v: Vector3, order: string): Matrix4;
|
||||
setRotationFromEuler(v: Vector3, order?: string): Matrix4;
|
||||
|
||||
/**
|
||||
* Sets the rotation submatrix of this matrix to the rotation specified by q.
|
||||
@@ -1593,7 +1624,7 @@ module THREE {
|
||||
set (origin: Vector3, direction: Vector3): Ray;
|
||||
copy(ray: Ray): Ray;
|
||||
at(t: number, optionalTarget?: Vector3): Vector3;
|
||||
recastSelf(t: number): Ray;
|
||||
recast(t: number): Ray;
|
||||
closestPointToPoint(point: Vector3, optionalTarget?: Vector3): Vector3;
|
||||
distanceToPoint(point: Vector3): number;
|
||||
isIntersectionSphere(sphere: Sphere): bool;
|
||||
@@ -2029,6 +2060,29 @@ module THREE {
|
||||
reparametrizeByArcLength(samplingCoef: number): void;
|
||||
}
|
||||
|
||||
class Triangle{
|
||||
constructor(a?: Vector3, b?: Vector3, c?: Vector3 );
|
||||
a: Vector3;
|
||||
b: Vector3;
|
||||
c: Vector3;
|
||||
set(a: Vector3, b: Vector3, c: Vector3): Triangle;
|
||||
setFromPointsAndIndices( points: Vector3[], i0: number, i1: number, i2: number ): Triangle;
|
||||
copy(triangle: Triangle): Triangle;
|
||||
area(): number;
|
||||
midpoint(optionalTarget?: Vector3): Vector3;
|
||||
normal(optionalTarget?: Vector3): Vector3;
|
||||
plane(optionalTarget?: Vector3): Plane;
|
||||
barycoordFromPoint(point: Vector3, optionalTarget?: Vector3): Vector3;
|
||||
containsPoint(point: Vector3): bool;
|
||||
equals(triangle: Triangle): bool;
|
||||
clone(): Triangle;
|
||||
static normal(a: Vector3, b: Vector3, c: Vector3, optionalTarget?: Vector3): Vector3;
|
||||
// static/instance method to calculate barycoordinates
|
||||
// based on: http://www.blackpawn.com/texts/pointinpoly/default.html
|
||||
static barycoordFromPoint(point: Vector3, a: Vector3, b: Vector3, c: Vector3, optionalTarget: Vector3 ): Vector3;
|
||||
static containsPoint(point: Vector3, a: Vector3, b: Vector3, c: Vector3): bool;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* ( interface Vector<T> )
|
||||
@@ -2042,6 +2096,10 @@ module THREE {
|
||||
* v.addVectors(new THREE.Vector2(0, 1), new THREE.Vector2(2, 3)); // invalid but compiled successfully
|
||||
*/
|
||||
export interface Vector {
|
||||
setComponent(index: number, value: number): void;
|
||||
|
||||
getComponent(index: number): number;
|
||||
|
||||
/**
|
||||
* copy(v:T):T;
|
||||
*/
|
||||
@@ -2155,6 +2213,26 @@ module THREE {
|
||||
*/
|
||||
set (x: number, y: number): Vector2;
|
||||
|
||||
/**
|
||||
* Sets X component of this vector.
|
||||
*/
|
||||
setX (x: number): Vector2;
|
||||
|
||||
/**
|
||||
* Sets Y component of this vector.
|
||||
*/
|
||||
setY(y: number): Vector2;
|
||||
|
||||
/**
|
||||
* Sets a component of this vector.
|
||||
*/
|
||||
setComponent(index: number, value: number): void;
|
||||
|
||||
/**
|
||||
* Gets a component of this vector.
|
||||
*/
|
||||
getComponent(index: number): number;
|
||||
|
||||
/**
|
||||
* Copies value of v to this vector.
|
||||
*/
|
||||
@@ -2191,6 +2269,12 @@ module THREE {
|
||||
*/
|
||||
divideScalar(s: number): Vector2;
|
||||
|
||||
min(v: Vector2): Vector2;
|
||||
|
||||
max(v: Vector2): Vector2;
|
||||
|
||||
clamp(min: Vector2, max: Vector2): Vector2;
|
||||
|
||||
/**
|
||||
* Inverts this vector.
|
||||
*/
|
||||
@@ -2461,6 +2545,30 @@ module THREE {
|
||||
*/
|
||||
set (x: number, y: number, z: number, w: number): Vector4;
|
||||
|
||||
/**
|
||||
* Sets X component of this vector.
|
||||
*/
|
||||
setX (x: number): Vector2;
|
||||
|
||||
/**
|
||||
* Sets Y component of this vector.
|
||||
*/
|
||||
setY(y: number): Vector2;
|
||||
|
||||
/**
|
||||
* Sets Z component of this vector.
|
||||
*/
|
||||
setZ(z: number): Vector2;
|
||||
|
||||
/**
|
||||
* Sets w component of this vector.
|
||||
*/
|
||||
setW(w: number): Vector2;
|
||||
|
||||
setComponent(index: number, value: number): void;
|
||||
|
||||
getComponent(index: number): number;
|
||||
|
||||
/**
|
||||
* Copies value of v to this vector.
|
||||
*/
|
||||
@@ -2497,6 +2605,12 @@ module THREE {
|
||||
*/
|
||||
divideScalar(s: number): Vector4;
|
||||
|
||||
min(v: Vector4): Vector4;
|
||||
|
||||
max(v: Vector4): Vector4;
|
||||
|
||||
clamp(min: Vector4, max: Vector4): Vector4;
|
||||
|
||||
/**
|
||||
* Inverts this vector.
|
||||
*/
|
||||
@@ -2512,11 +2626,6 @@ module THREE {
|
||||
*/
|
||||
lengthSq(): number;
|
||||
|
||||
/**
|
||||
* Computes dot product of this vector and v.
|
||||
*/
|
||||
dot(v: Vector4): Vector4;
|
||||
|
||||
/**
|
||||
* Computes length of this vector.
|
||||
*/
|
||||
@@ -2579,6 +2688,8 @@ module THREE {
|
||||
|
||||
export class Box2 {
|
||||
constructor(min?: Vector2, max?: Vector2);
|
||||
min: Vector2;
|
||||
max: Vector2;
|
||||
set (min: Vector2, max: Vector2): Box2;
|
||||
setFromPoints(points: Vector2[]): Box2;
|
||||
setFromCenterAndSize(center: Vector2, size: number): Box2;
|
||||
@@ -2595,7 +2706,7 @@ module THREE {
|
||||
getParameter(point: Vector2): Vector2;
|
||||
isIntersectionBox(box: Box2): bool;
|
||||
clampPoint(point: Vector2, optionalTarget?: Vector2): Vector2;
|
||||
distanceToPoint(point: Vector2): Vector2;
|
||||
distanceToPoint(point: Vector2): number;
|
||||
intersect(box: Box2): Box2;
|
||||
union(box: Box2): Box2;
|
||||
translate(offset: Vector2): Box2;
|
||||
@@ -2605,6 +2716,8 @@ module THREE {
|
||||
|
||||
export class Box3 {
|
||||
constructor(min?: Vector3, max?: Vector3);
|
||||
min: Vector3;
|
||||
max: Vector3;
|
||||
set (min: Vector3, max: Vector3): Box3;
|
||||
setFromPoints(points: Vector3[]): Box3;
|
||||
setFromCenterAndSize(center: Vector3, size: number): Box3;
|
||||
@@ -2621,7 +2734,8 @@ module THREE {
|
||||
getParameter(point: Vector3): Vector3;
|
||||
isIntersectionBox(box: Box3): bool;
|
||||
clampPoint(point: Vector3, optionalTarget?: Vector3): Vector3;
|
||||
distanceToPoint(point: Vector3): Vector3;
|
||||
distanceToPoint(point: Vector3): number;
|
||||
getBoundingSphere(): Sphere;
|
||||
intersect(box: Box3): Box3;
|
||||
union(box: Box3): Box3;
|
||||
applyMatrix4(matrix: Matrix4): Box3;
|
||||
@@ -3286,6 +3400,27 @@ module THREE {
|
||||
add(loader: Loader): void;
|
||||
}
|
||||
|
||||
interface SceneLoaderResult{
|
||||
scene: Scene;
|
||||
geometries: {[id:string]:Geometry;};
|
||||
face_materials: {[id:string]:Material;};
|
||||
materials: {[id:string]:Material;};
|
||||
textures: {[id:string]:Texture;};
|
||||
objects: {[id:string]:Object3D;};
|
||||
cameras: {[id:string]:Camera;};
|
||||
lights: {[id:string]:Light;};
|
||||
fogs: {[id:string]:IFog;};
|
||||
empties: {[id:string]:any;};
|
||||
groups: {[id:string]:any;};
|
||||
}
|
||||
|
||||
interface SceneLoaderProgress{
|
||||
totalModels: number;
|
||||
totalTextures: number;
|
||||
loadedModels: number;
|
||||
loadedTextures: number;
|
||||
}
|
||||
|
||||
/**
|
||||
* A loader for loading a complete scene out of a JSON file.
|
||||
*/
|
||||
@@ -3314,19 +3449,29 @@ module THREE {
|
||||
* Will be called when load completes.
|
||||
* The default is a function with empty body.
|
||||
*/
|
||||
callbackSync: () => void;
|
||||
callbackSync: (result: SceneLoaderResult) => void;
|
||||
|
||||
/**
|
||||
* Will be called as load progresses.
|
||||
* The default is a function with empty body.
|
||||
*/
|
||||
callbackProgress: () => void;
|
||||
callbackProgress: (progress: SceneLoaderProgress, result: SceneLoaderResult) => void;
|
||||
|
||||
geometryHandlerMap: any;
|
||||
hierarchyHandlerMap: any;
|
||||
|
||||
|
||||
/**
|
||||
* @param url
|
||||
* @param callbackFinished This function will be called with the loaded model as an instance of scene when the load is completed.
|
||||
*/
|
||||
load(url: string, callbackFinished: (scene: Scene) => void ): void;
|
||||
|
||||
addGeometryHandler(typeID: string, loaderClass: Object): void;
|
||||
|
||||
addHierarchyHandler(typeID: string, loaderClass: Object): void;
|
||||
|
||||
static parse(json: any, callbackFinished:(result: SceneLoaderResult)=>void, url: string): void;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -3462,7 +3607,7 @@ module THREE {
|
||||
linewidth?: number;
|
||||
linecap?: string;
|
||||
linejoin?: string;
|
||||
vertexColors?: bool;
|
||||
vertexColors?: Colors;
|
||||
fog?: bool;
|
||||
}
|
||||
|
||||
@@ -3781,8 +3926,9 @@ module THREE {
|
||||
|
||||
|
||||
export interface Uniforms {
|
||||
[name: string]: { type: string; value: Object; };
|
||||
[name: string]: { type: string; value: any; };
|
||||
//[name:string]:{type:UniformType;value:Object;};
|
||||
color?: { type: string; value: THREE.Color; };
|
||||
}
|
||||
|
||||
export interface ShaderMaterialParameters {
|
||||
@@ -3835,12 +3981,19 @@ module THREE {
|
||||
constructor(geometry?: Geometry, material?: LineDashedMaterial, type?: number);
|
||||
constructor(geometry?: Geometry, material?: LineBasicMaterial, type?: number);
|
||||
constructor(geometry?: Geometry, material?: ShaderMaterial, type?: number);
|
||||
constructor(geometry?: BufferGeometry, material?: LineDashedMaterial, type?: number);
|
||||
constructor(geometry?: BufferGeometry, material?: LineBasicMaterial, type?: number);
|
||||
constructor(geometry?: BufferGeometry, material?: ShaderMaterial, type?: number);
|
||||
geometry: Geometry;
|
||||
material: Material;
|
||||
type: number;
|
||||
type: LineType;
|
||||
clone(object?: Line): Line;
|
||||
}
|
||||
|
||||
enum LineType{}
|
||||
var LineStrip: LineType;
|
||||
var LinePieces: LineType;
|
||||
|
||||
export class LOD extends Object3D {
|
||||
constructor();
|
||||
LODs: Object3D[];
|
||||
@@ -3857,6 +4010,15 @@ module THREE {
|
||||
constructor(geometry?: Geometry, material?: MeshNormalMaterial);
|
||||
constructor(geometry?: Geometry, material?: MeshPhongMaterial);
|
||||
constructor(geometry?: Geometry, material?: ShaderMaterial);
|
||||
|
||||
constructor(geometry?: BufferGeometry , material?: MeshBasicMaterial);
|
||||
constructor(geometry?: BufferGeometry , material?: MeshDepthMaterial);
|
||||
constructor(geometry?: BufferGeometry , material?: MeshFaceMaterial);
|
||||
constructor(geometry?: BufferGeometry , material?: MeshLambertMaterial);
|
||||
constructor(geometry?: BufferGeometry , material?: MeshNormalMaterial);
|
||||
constructor(geometry?: BufferGeometry , material?: MeshPhongMaterial);
|
||||
constructor(geometry?: BufferGeometry , material?: ShaderMaterial);
|
||||
|
||||
geometry: Geometry;
|
||||
material: Material;
|
||||
morphTargetBase: number;
|
||||
@@ -3913,6 +4075,10 @@ module THREE {
|
||||
constructor(geometry: Geometry, material?: ParticleCanvasMaterial);
|
||||
constructor(geometry: Geometry, material?: ParticleDOMMaterial);
|
||||
constructor(geometry: Geometry, material?: ShaderMaterial);
|
||||
constructor(geometry: BufferGeometry, material?: ParticleBasicMaterial);
|
||||
constructor(geometry: BufferGeometry, material?: ParticleCanvasMaterial);
|
||||
constructor(geometry: BufferGeometry, material?: ParticleDOMMaterial);
|
||||
constructor(geometry: BufferGeometry, material?: ShaderMaterial);
|
||||
|
||||
/**
|
||||
* An instance of Geometry, where each vertex designates the position of a particle in the system.
|
||||
@@ -3940,13 +4106,13 @@ module THREE {
|
||||
}
|
||||
|
||||
export class SkinnedMesh extends Mesh {
|
||||
constructor(geometry?: Geometry, material?: MeshBasicMaterial);
|
||||
constructor(geometry?: Geometry, material?: MeshDepthMaterial);
|
||||
constructor(geometry?: Geometry, material?: MeshFaceMaterial);
|
||||
constructor(geometry?: Geometry, material?: MeshLambertMaterial);
|
||||
constructor(geometry?: Geometry, material?: MeshNormalMaterial);
|
||||
constructor(geometry?: Geometry, material?: MeshPhongMaterial);
|
||||
constructor(geometry?: Geometry, material?: ShaderMaterial);
|
||||
constructor(geometry?: Geometry, material?: MeshBasicMaterial, useVertexTexture?: bool);
|
||||
constructor(geometry?: Geometry, material?: MeshDepthMaterial, useVertexTexture?: bool);
|
||||
constructor(geometry?: Geometry, material?: MeshFaceMaterial, useVertexTexture?: bool);
|
||||
constructor(geometry?: Geometry, material?: MeshLambertMaterial, useVertexTexture?: bool);
|
||||
constructor(geometry?: Geometry, material?: MeshNormalMaterial, useVertexTexture?: bool);
|
||||
constructor(geometry?: Geometry, material?: MeshPhongMaterial, useVertexTexture?: bool);
|
||||
constructor(geometry?: Geometry, material?: ShaderMaterial, useVertexTexture?: bool);
|
||||
useVertexTexture: bool;
|
||||
identityMatrix: Matrix4;
|
||||
bones: Bone[];
|
||||
@@ -4692,6 +4858,17 @@ module THREE {
|
||||
type?: TextureDataType,
|
||||
anisotropy?: number
|
||||
);
|
||||
constructor(
|
||||
image: HTMLCanvasElement,
|
||||
mapping?: Mapping,
|
||||
wrapS?: Wrapping,
|
||||
wrapT?: Wrapping,
|
||||
magFilter?: TextureFilter,
|
||||
minFilter?: TextureFilter,
|
||||
format?: PixelFormat,
|
||||
type?: TextureDataType,
|
||||
anisotropy?: number
|
||||
);
|
||||
id: number;
|
||||
name: string;
|
||||
image: Object; // HTMLImageElement or ImageData ;
|
||||
@@ -4831,6 +5008,8 @@ module THREE {
|
||||
|
||||
getNextKeyWith(type: string, h: number, key: number): KeyFrame; // ????
|
||||
getPrevKeyWith(type: string, h: number, key: number): KeyFrame;
|
||||
|
||||
JITCompile: bool; // https://github.com/mrdoob/three.js/blob/master/examples/webgl_animation_skinning_morph.html#L251
|
||||
}
|
||||
|
||||
export class AnimationInterpolation { }
|
||||
@@ -5291,8 +5470,8 @@ module THREE {
|
||||
* Defines a 2d shape plane using paths.
|
||||
*/
|
||||
export class Shape extends Path {
|
||||
constructor();
|
||||
holes: Vector2[][];
|
||||
constructor(points?: Vector2[]);
|
||||
holes: Path[];
|
||||
extrude(options?: any): ExtrudeGeometry;
|
||||
makeGeometry(options?: any): ShapeGeometry;
|
||||
getPointsHoles(divisions: number): Vector2[][];
|
||||
@@ -5341,7 +5520,7 @@ module THREE {
|
||||
}
|
||||
|
||||
export class ConvexGeometry extends Geometry {
|
||||
constructor(vertices: Vector3);
|
||||
constructor(vertices: Vector3[]);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -5415,8 +5594,8 @@ module THREE {
|
||||
}
|
||||
|
||||
export class ShapeGeometry extends Geometry {
|
||||
constructor(shape: Shape, options: any);
|
||||
constructor(shapes: Shape[], options: any);
|
||||
constructor(shape: Shape, options?: any);
|
||||
constructor(shapes: Shape[], options?: any);
|
||||
shapebb: BoundingBox;
|
||||
addShapeList(shapes: Shape[], options: any): ShapeGeometry;
|
||||
addShape(shape: Shape, options?: any): void;
|
||||
@@ -5489,7 +5668,12 @@ module THREE {
|
||||
}
|
||||
|
||||
export class TubeGeometry extends Geometry {
|
||||
constructor(path: Path, segments?: number, radius?: number, radiusSegments?: number, closed?: bool, debug?: ArrowHelper[]);
|
||||
constructor(path: Path, segments?: number, radius?: number, radiusSegments?: number, closed?: bool, debug?: Object3D);
|
||||
|
||||
// https://github.com/mrdoob/three.js/blob/master/examples/webgl_geometry_extrude_shapes.html#L208
|
||||
// Hmmm?
|
||||
constructor(path: SplineCurve3, segments?: number, radius?: number, radiusSegments?: number, closed?: bool, debug?: bool);
|
||||
|
||||
path: Path;
|
||||
segments: number;
|
||||
radius: number;
|
||||
@@ -5591,11 +5775,11 @@ module THREE {
|
||||
}
|
||||
|
||||
export class LensFlare extends Object3D {
|
||||
constructor(texture?: Texture, size?: number, distance?: number, blending?: Blending, color?: number);
|
||||
constructor(texture?: Texture, size?: number, distance?: number, blending?: Blending, color?: Color);
|
||||
lensFlares: LensFlareProperty[];
|
||||
positionScreen: Vector3;
|
||||
customUpdateCallback: () => void;
|
||||
add(texture?: Texture, size?: number, distance?: number, blending?: Blending, color?: number, opacity?: number): void;
|
||||
customUpdateCallback: (object:LensFlare) => void;
|
||||
add(texture?: Texture, size?: number, distance?: number, blending?: Blending, color?: Color, opacity?: number): void;
|
||||
updateLensFlares(): void;
|
||||
}
|
||||
|
||||
@@ -5679,7 +5863,7 @@ module THREE {
|
||||
export var UniformsUtils: {
|
||||
merge(uniforms: Object[]): Uniforms;
|
||||
merge(uniforms: Uniforms[]): Uniforms;
|
||||
clone(uniforms_src: Object[][]): Object[][];
|
||||
clone(uniforms_src: Uniforms): Uniforms;
|
||||
};
|
||||
|
||||
export var UniformsLib: {
|
||||
|
||||
Vendored
+5
-1
@@ -62,6 +62,10 @@ interface ToastrOptions {
|
||||
*/
|
||||
positionClass?: string;
|
||||
/**
|
||||
* Where toast should be displayed - background
|
||||
*/
|
||||
backgroundpositionClass?: string;
|
||||
/**
|
||||
* Time in milliseconds that the toast should be displayed
|
||||
*/
|
||||
timeOut?: number;
|
||||
@@ -146,4 +150,4 @@ interface Toastr {
|
||||
version: string;
|
||||
}
|
||||
|
||||
declare var toastr: Toastr;
|
||||
declare var toastr: Toastr;
|
||||
|
||||
Vendored
+51
@@ -0,0 +1,51 @@
|
||||
// Type definitions for trunk8
|
||||
// Project: https://github.com/rviscomi/trunk8
|
||||
// Definitions by: Blake Niemyjski <https://github.com/niemyjski/>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
/// <reference path="../jquery/jquery.d.ts"/>
|
||||
|
||||
interface Trunk8Options {
|
||||
/**
|
||||
(Default: '…') The string to insert in place of the omitted text. This value may include HTML.
|
||||
@param {string} fill
|
||||
*/
|
||||
fill?: string;
|
||||
/**
|
||||
(Default: 1) The number of lines of text-wrap to tolerate before truncating. This value must be an integer greater than or equal to 1.
|
||||
@param {number} lines
|
||||
*/
|
||||
lines?: number;
|
||||
/**
|
||||
(Default: 'right') The side of the text from which to truncate. Valid values include 'center', 'left', and 'right'.
|
||||
@param {string} side
|
||||
*/
|
||||
side?: string;
|
||||
/**
|
||||
(Default: true) When true, the title attribute of the targeted HTML element will be set to the original, untruncated string. Valid values include true and false.
|
||||
@param {bool} tooltip
|
||||
*/
|
||||
tooltip?: bool;
|
||||
/**
|
||||
(Default: 'auto') The width, in characters, of the desired text. When set to 'auto', trunk8 will maximize the amount of text without spilling over.
|
||||
@param {string} width
|
||||
*/
|
||||
width?: string;
|
||||
}
|
||||
|
||||
interface JQuery {
|
||||
/**
|
||||
Creates a trunk8 instance and calls a method.
|
||||
@constructor
|
||||
@param {string} method
|
||||
@param {string} value
|
||||
*/
|
||||
trunk8(method: string, value?: string): any;
|
||||
|
||||
/**
|
||||
Creates a trunk8 instance with default options.
|
||||
@constructor
|
||||
@param {Trunk8Options} options
|
||||
*/
|
||||
trunk8(options?: Trunk8Options): any;
|
||||
}
|
||||
Vendored
+20
-21
@@ -12,10 +12,10 @@
|
||||
|
||||
module createjs {
|
||||
|
||||
export class TweenJS {
|
||||
// properties
|
||||
version: string;
|
||||
buildDate: string;
|
||||
export class TweenJS {
|
||||
// properties
|
||||
version: string;
|
||||
buildDate: string;
|
||||
}
|
||||
|
||||
|
||||
@@ -120,7 +120,7 @@ module createjs {
|
||||
// methods
|
||||
call(callback: (tweenObject: Tween) => any, params?: any[], scope?: Object); // when 'params' isn't given, the callback receives a tweenObject
|
||||
call(callback: (...params: any[]) => any, params?: any[], scope?: Object); // otherwise, it receives the params only
|
||||
static get(target, props: Object): Tween;
|
||||
static get(target, props?: Object, pluginData?: Object, override?: bool): Tween;
|
||||
static hasActiveTweens(target? ): void;
|
||||
static installPlugin(plugin: Object, properties: Object): void;
|
||||
pause(tween: Tween): void;
|
||||
@@ -137,24 +137,23 @@ module createjs {
|
||||
// events
|
||||
change: (event) => any;
|
||||
|
||||
// EventDispatcher mixins
|
||||
addEventListener(type: string, listener: (eventObj: Object) => bool): Function;
|
||||
addEventListener(type: string, listener: (eventObj: Object) => bool): Object;
|
||||
removeEventListener(type: string, listener: (eventObj: Function) => bool): void;
|
||||
removeEventListener(type: string, listener: (eventObj: Object) => bool): void;
|
||||
removeAllEventListeners(type: string): void;
|
||||
dispatchEvent(eventObj: string, target: Object): bool;
|
||||
dispatchEvent(eventObj: Object, target: Object): bool;
|
||||
hasEventListener(type: string): bool;
|
||||
// EventDispatcher mixins
|
||||
addEventListener(type: string, listener: (eventObj: Object) => bool): Function;
|
||||
addEventListener(type: string, listener: (eventObj: Object) => bool): Object;
|
||||
removeEventListener(type: string, listener: (eventObj: Function) => bool): void;
|
||||
removeEventListener(type: string, listener: (eventObj: Object) => bool): void;
|
||||
removeAllEventListeners(type: string): void;
|
||||
dispatchEvent(eventObj: string, target: Object): bool;
|
||||
dispatchEvent(eventObj: Object, target: Object): bool;
|
||||
hasEventListener(type: string): bool;
|
||||
}
|
||||
|
||||
|
||||
export class MotionGuidePlugin {
|
||||
// properties
|
||||
static priority: number;
|
||||
export class MotionGuidePlugin {
|
||||
// properties
|
||||
static priority: number;
|
||||
|
||||
//methods
|
||||
static install(): Object;
|
||||
|
||||
}
|
||||
//methods
|
||||
static install(): Object;
|
||||
}
|
||||
}
|
||||
|
||||
Vendored
+101
@@ -0,0 +1,101 @@
|
||||
// Type definitions for Underscore-ko 1.2.2 with underscore 1.4
|
||||
// Project: https://github.com/kamranayub/UnderscoreKO
|
||||
// Definitions by: Maurits Elbers <https://github.com/MagicMau/>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
/// <reference path="../knockout/knockout.d.ts" />
|
||||
/// <reference path="../underscore/underscore.d.ts" />
|
||||
|
||||
interface KnockoutObservableArrayFunctions {
|
||||
|
||||
/****
|
||||
Collections
|
||||
*****/
|
||||
each(iterator: ListIterator, context?: any): any[];
|
||||
each(iterator: ObjectIterator, context?: any): any[];
|
||||
forEach(iterator: ObjectIterator, context?: any): any[];
|
||||
forEach(iterator: ListIterator, context?: any): any[];
|
||||
|
||||
map(iterator: ListIterator, context?: any): any[];
|
||||
map(iterator: ObjectIterator, context?: any): any[];
|
||||
collect(iterator: ListIterator, context?: any): any[];
|
||||
collect(iterator: ObjectIterator, context?: any): any[];
|
||||
|
||||
reduce(iterator: any, memo: any, context?: any): any;
|
||||
inject(iterator: any, memo: any, context?: any): any;
|
||||
foldl(iterator: any, memo: any, context?: any): any;
|
||||
|
||||
reduceRight(iterator: any, memo: any, context?: any): any[];
|
||||
foldr(iterator: any, memo: any, context?: any): any[];
|
||||
|
||||
find(iterator: any, context?: any): any;
|
||||
detect(iterator: any, context?: any): any;
|
||||
|
||||
filter(iterator: any, context?: any): any[];
|
||||
select(iterator: any, context?: any): any[];
|
||||
|
||||
where(properties: any): any[];
|
||||
|
||||
reject(iterator: any, context?: any): any[];
|
||||
|
||||
all(iterator: any, context?: any): bool;
|
||||
every(iterator: any, context?: any): bool;
|
||||
|
||||
any(iterator?: any, context?: any): bool;
|
||||
some(iterator?: any, context?: any): bool;
|
||||
|
||||
contains(list: any, value: any): bool;
|
||||
contains(value: any): bool;
|
||||
include(list: any, value: any): bool;
|
||||
include(value: any): bool;
|
||||
|
||||
invoke(methodName: string, arguments: any[]): any;
|
||||
invoke(methodName: string, ...arguments: any[]): any;
|
||||
|
||||
pluck(propertyName: string): string[];
|
||||
max(iterator?: any, context?: any): any;
|
||||
min(iterator?: any, context?: any): any;
|
||||
sortBy(iterator?: any, context?: any): any;
|
||||
groupBy(iterator: any): any;
|
||||
countBy(iterator: any): any;
|
||||
shuffle(): any[];
|
||||
size(): number;
|
||||
|
||||
/****
|
||||
Arrays
|
||||
*****/
|
||||
first(n?: number): any;
|
||||
head(n?: number): any;
|
||||
take(n?: number): any;
|
||||
|
||||
initial(n?: number): any[];
|
||||
|
||||
last(n?: number): any;
|
||||
|
||||
rest(n?: number): any[];
|
||||
tail(n?: number): any[];
|
||||
drop(n?: number): any[];
|
||||
|
||||
compact(): any[];
|
||||
flatten(shallow?: bool): any[];
|
||||
without(...values: any[]): any[];
|
||||
union(...arrays: any[][]): any[];
|
||||
intersection(...arrays: any[][]): any[];
|
||||
difference(...others: any[][]): any[];
|
||||
|
||||
uniq(isSorted?: bool, iterator?: any): any[];
|
||||
unique(isSorted?: bool, iterator?: any): any[];
|
||||
|
||||
zip(...arrays: any[]): any[];
|
||||
object(values?: any[]): any;
|
||||
indexOf(value: any, isSorted?: bool): number;
|
||||
lastIndexOf(value: any, fromIndex?: number): number;
|
||||
sortedIndex(valueL: any, iterator?: any): number;
|
||||
range(stop: number): any[];
|
||||
range(start: number, stop: number, step?: number): any[];
|
||||
|
||||
/****
|
||||
Chaining
|
||||
*****/
|
||||
chain(object: any): UnderscoreWrappedObject;
|
||||
}
|
||||
Vendored
+820
-2
@@ -1197,7 +1197,7 @@ interface Underscore {
|
||||
* @param obj Object to chain.
|
||||
* @return Wrapped `obj`.
|
||||
**/
|
||||
chain(obj: any): UnderscoreOOPWrapper;
|
||||
chain(obj: any): UnderscoreChain;
|
||||
|
||||
/**
|
||||
* Extracts the value of a wrapped object.
|
||||
@@ -2048,7 +2048,825 @@ interface UnderscoreOOPWrapper {
|
||||
* Wrapped type `any`.
|
||||
* @see _.chain
|
||||
**/
|
||||
chain(): any;
|
||||
chain(): UnderscoreChain;
|
||||
|
||||
/**
|
||||
* Wrapped type `any`.
|
||||
* @see _.value
|
||||
**/
|
||||
value(): any;
|
||||
}
|
||||
|
||||
interface UnderscoreChain {
|
||||
|
||||
/**************
|
||||
* Collections *
|
||||
**************/
|
||||
|
||||
/**
|
||||
* Wrapped type `any[]`.
|
||||
* @see _.each
|
||||
**/
|
||||
each(
|
||||
iterator: (element: any, index?: number, list?: any[]) => any,
|
||||
context?: any): UnderscoreChain;
|
||||
/**
|
||||
* Wrapped type `object`.
|
||||
* @see _.each
|
||||
**/
|
||||
each(
|
||||
iterator: (value: any, key?: string, object?: Object) => any,
|
||||
context?: any): UnderscoreChain;
|
||||
|
||||
/**
|
||||
* Alias for 'each'.
|
||||
* @see each
|
||||
**/
|
||||
forEach(
|
||||
iterator: (element: any, index?: number, list?: any[]) => any,
|
||||
context?: any): UnderscoreChain;
|
||||
/**
|
||||
* Alias for 'each'.
|
||||
* @see each
|
||||
**/
|
||||
forEach(
|
||||
iterator: (value: any, key?: string, object?: Object) => any,
|
||||
context?: any): UnderscoreChain;
|
||||
|
||||
/**
|
||||
* Wrapped type `any[]`.
|
||||
* @see _.map
|
||||
**/
|
||||
map(
|
||||
iterator: (element: any, index?: number, list?: any[]) => any,
|
||||
context?: any): UnderscoreChain;
|
||||
/**
|
||||
* Wrapped type `object`.
|
||||
* @see _.map
|
||||
**/
|
||||
map(
|
||||
iterator: (value: any, key?: string, object?: Object) => any,
|
||||
context?: any): UnderscoreChain;
|
||||
|
||||
/**
|
||||
* Alias for 'map'.
|
||||
* @see map
|
||||
**/
|
||||
collect(
|
||||
iterator: (element: any, index?: number, list?: any[]) => any,
|
||||
context?: any): UnderscoreChain;
|
||||
/**
|
||||
* Alias for 'map'.
|
||||
* @see map
|
||||
**/
|
||||
collect(
|
||||
iterator: (value: any, key?: string, object?: Object) => any,
|
||||
context?: any): UnderscoreChain;
|
||||
|
||||
/**
|
||||
* Wrapped type `any[]`.
|
||||
* @see _.reduce
|
||||
**/
|
||||
reduce(
|
||||
iterator: (memo: any, element: any, index?: number, list?: any[]) => any,
|
||||
memo: any,
|
||||
context?: any): UnderscoreChain;
|
||||
|
||||
/**
|
||||
* Alias for 'reduce'.
|
||||
* @see reduce
|
||||
**/
|
||||
inject(
|
||||
iterator: (memo: any, element: any, index?: number, list?: any[]) => any,
|
||||
memo: any,
|
||||
context?: any): UnderscoreChain;
|
||||
|
||||
/**
|
||||
* Alias for 'reduce'.
|
||||
* @see reduce
|
||||
**/
|
||||
foldl(
|
||||
iterator: (memo: any, element: any, index?: number, list?: any[]) => any,
|
||||
memo: any,
|
||||
context?: any): UnderscoreChain;
|
||||
|
||||
/**
|
||||
* Wrapped type `any[]`.
|
||||
* @see _.reduceRight
|
||||
**/
|
||||
reduceRight(
|
||||
iterator: (memo: any, element: any, index?: number, list?: any[]) => any,
|
||||
memo: any,
|
||||
context?: any): UnderscoreChain;
|
||||
|
||||
/**
|
||||
* Alias for 'reduceRight'.
|
||||
* @see reduceRight
|
||||
**/
|
||||
foldr(
|
||||
iterator: (memo: any, element: any, index?: number, list?: any[]) => any,
|
||||
memo: any,
|
||||
context?: any): UnderscoreChain;
|
||||
|
||||
/**
|
||||
* Wrapped type `any[]`.
|
||||
* @see _.find
|
||||
**/
|
||||
find(
|
||||
iterator: (element: any, index?: number, list?: any[]) => bool,
|
||||
context?: any): UnderscoreChain;
|
||||
|
||||
/**
|
||||
* Alias for 'find'.
|
||||
* @see find
|
||||
**/
|
||||
detect(
|
||||
iterator: (element: any, index?: number, list?: any[]) => bool,
|
||||
context?: any): UnderscoreChain;
|
||||
|
||||
|
||||
/**
|
||||
* Wrapped type `any[]`.
|
||||
* @see _.filter
|
||||
**/
|
||||
filter(
|
||||
iterator: (element: any, index?: number, list?: any[]) => bool,
|
||||
context?: any): UnderscoreChain;
|
||||
|
||||
/**
|
||||
* Alias for 'filter'.
|
||||
* @see filter
|
||||
**/
|
||||
select(
|
||||
iterator: (element: any, index?: number, list?: any[]) => bool,
|
||||
context?: any): UnderscoreChain;
|
||||
|
||||
/**
|
||||
* Wrapped type `any[]`.
|
||||
* @see _.where
|
||||
**/
|
||||
where(list: any[], properties: any): UnderscoreChain;
|
||||
|
||||
/**
|
||||
* Wrapped type `any[]`.
|
||||
* @see _.findWhere
|
||||
**/
|
||||
findWhere(properties: any): UnderscoreChain;
|
||||
|
||||
/**
|
||||
* Wrapped type `any[]`.
|
||||
* @see _.reject
|
||||
**/
|
||||
reject(
|
||||
list: any[],
|
||||
iterator: (element: any, index?: number, list?: any[]) => bool,
|
||||
context?: any): UnderscoreChain;
|
||||
|
||||
/**
|
||||
* Wrapped type `any[]`.
|
||||
* @see _.all
|
||||
**/
|
||||
all(
|
||||
iterator: (element: any, index?: number, list?: any[]) => bool,
|
||||
context?: any): UnderscoreChain;
|
||||
|
||||
/**
|
||||
* Alias for 'all'.
|
||||
* @see all
|
||||
**/
|
||||
every(
|
||||
iterator: (element: any, index?: number, list?: any[]) => bool,
|
||||
context?: any): UnderscoreChain;
|
||||
|
||||
/**
|
||||
* Wrapped type `any[]`.
|
||||
* @see _.any
|
||||
**/
|
||||
any(
|
||||
list: any[],
|
||||
iterator?: (element: any, index?: number, list?: any[]) => bool,
|
||||
context?: any): UnderscoreChain;
|
||||
|
||||
/**
|
||||
* Alias for 'any'.
|
||||
* @see any
|
||||
**/
|
||||
some(
|
||||
list: any[],
|
||||
iterator: (element: any, index?: number, list?: any[]) => bool,
|
||||
context?: any): UnderscoreChain;
|
||||
|
||||
/**
|
||||
* Wrapped type `any[]`.
|
||||
* @see _.contains
|
||||
**/
|
||||
contains(value: any): UnderscoreChain;
|
||||
|
||||
/**
|
||||
* Alias for 'contains'.
|
||||
* @see contains
|
||||
**/
|
||||
include(value: any): UnderscoreChain;
|
||||
|
||||
/**
|
||||
* Wrapped type `any[]`.
|
||||
* @see _.invoke
|
||||
**/
|
||||
invoke(methodName: string, ...arguments: any[]): UnderscoreChain;
|
||||
|
||||
/**
|
||||
* Wrapped type `any[]`.
|
||||
* @see _.pluck
|
||||
**/
|
||||
pluck(propertyName: string): UnderscoreChain;
|
||||
|
||||
/**
|
||||
* Wrapped type `number[]`.
|
||||
* @see _.max
|
||||
**/
|
||||
max(): UnderscoreChain;
|
||||
/**
|
||||
* Wrapped type `any[]`.
|
||||
* @see _.max
|
||||
**/
|
||||
max(
|
||||
iterator: (element: any, index?: number, list?: any[]) => number,
|
||||
context?: any): UnderscoreChain;
|
||||
|
||||
/**
|
||||
* Wrapped type `number[]`.
|
||||
* @see _.min
|
||||
**/
|
||||
min(): UnderscoreChain;
|
||||
/**
|
||||
* Wrapped type `any[]`.
|
||||
* @see _.min
|
||||
**/
|
||||
min(
|
||||
iterator: (obj: any, index?: number, list?: any[]) => number,
|
||||
context?: any): UnderscoreChain;
|
||||
|
||||
/**
|
||||
* Wrapped type `any[]`.
|
||||
* @see _.sortBy
|
||||
**/
|
||||
sortBy(
|
||||
iterator: (element: any, index?: number, list?: any[]) => any,
|
||||
context?: any): UnderscoreChain;
|
||||
/**
|
||||
* Wrapped type `any[]`.
|
||||
* @see _.sortBy
|
||||
**/
|
||||
sortBy(
|
||||
iterator: string,
|
||||
context?: any): UnderscoreChain;
|
||||
|
||||
/**
|
||||
* Wrapped type `any[]`.
|
||||
* @see _.groupBy
|
||||
**/
|
||||
groupBy(
|
||||
iterator: (element: any, index?: number, list?: any[]) => string,
|
||||
context?: any): UnderscoreChain;
|
||||
/**
|
||||
* Wrapped type `any[]`.
|
||||
* @see _.groupBy
|
||||
**/
|
||||
groupBy(
|
||||
iterator: string,
|
||||
context?: any): UnderscoreChain;
|
||||
|
||||
/**
|
||||
* Wrapped type `any[]`.
|
||||
* @see _.countBy
|
||||
**/
|
||||
countBy(
|
||||
iterator: (element: any, index?: number, list?: any[]) => string,
|
||||
context?: any): UnderscoreChain;
|
||||
/**
|
||||
* Wrapped type `any[]`.
|
||||
* @see _.countBy
|
||||
**/
|
||||
countBy(
|
||||
iterator: string,
|
||||
context?: any): UnderscoreChain;
|
||||
|
||||
/**
|
||||
* Wrapped type `any[]`.
|
||||
* @see _.shuffle
|
||||
**/
|
||||
shuffle(): UnderscoreChain;
|
||||
|
||||
/**
|
||||
* Wrapped type `any`.
|
||||
* @see _.toArray
|
||||
**/
|
||||
toArray(): UnderscoreChain;
|
||||
|
||||
/**
|
||||
* Wrapped type `any`.
|
||||
* @see _.size
|
||||
**/
|
||||
size(): UnderscoreChain;
|
||||
|
||||
/*********
|
||||
* Arrays *
|
||||
**********/
|
||||
|
||||
/**
|
||||
* Wrapped type `any[]`.
|
||||
* @see _.first
|
||||
**/
|
||||
first(): UnderscoreChain;
|
||||
/**
|
||||
* Wrapped type `any[]`.
|
||||
* @see _.first
|
||||
**/
|
||||
first(n: number): UnderscoreChain;
|
||||
|
||||
/**
|
||||
* Alias for 'first'.
|
||||
* @see first
|
||||
**/
|
||||
head(): UnderscoreChain;
|
||||
/**
|
||||
* Alias for 'first'.
|
||||
* @see first
|
||||
**/
|
||||
head(n: number): UnderscoreChain;
|
||||
|
||||
/**
|
||||
* Alias for 'first'.
|
||||
* @see first
|
||||
**/
|
||||
take(): UnderscoreChain;
|
||||
/**
|
||||
* Alias for 'first'.
|
||||
* @see first
|
||||
**/
|
||||
take(n: number): UnderscoreChain;
|
||||
|
||||
/**
|
||||
* Wrapped type `any[]`.
|
||||
* @see _.initial
|
||||
**/
|
||||
initial(n?: number): UnderscoreChain;
|
||||
|
||||
/**
|
||||
* Wrapped type `any[]`.
|
||||
* @see _.last
|
||||
**/
|
||||
last(): UnderscoreChain;
|
||||
/**
|
||||
* Wrapped type `any[]`.
|
||||
* @see _.last
|
||||
**/
|
||||
last(n: number): UnderscoreChain;
|
||||
|
||||
/**
|
||||
* Wrapped type `any[]`.
|
||||
* @see _.rest
|
||||
**/
|
||||
rest(index?: number): UnderscoreChain;
|
||||
|
||||
/**
|
||||
* Alias for 'rest'.
|
||||
* @see rest
|
||||
**/
|
||||
tail(index?: number): UnderscoreChain;
|
||||
|
||||
/**
|
||||
* Alias for 'rest'.
|
||||
* @see rest
|
||||
**/
|
||||
drop(index?: number): UnderscoreChain;
|
||||
|
||||
/**
|
||||
* Wrapped type `any[]`.
|
||||
* @see _.compact
|
||||
**/
|
||||
compact(): UnderscoreChain;
|
||||
|
||||
/**
|
||||
* Wrapped type `any`.
|
||||
* @see _.flatten
|
||||
**/
|
||||
flatten(shallow?: bool): UnderscoreChain;
|
||||
|
||||
/**
|
||||
* Wrapped type `any[]`.
|
||||
* @see _.without
|
||||
**/
|
||||
without(...values: any[]): UnderscoreChain;
|
||||
|
||||
/**
|
||||
* Wrapped type `any[][]`.
|
||||
* @see _.union
|
||||
**/
|
||||
union(...arrays: any[][]): UnderscoreChain;
|
||||
|
||||
/**
|
||||
* Wrapped type `any[][]`.
|
||||
* @see _.intersection
|
||||
**/
|
||||
intersection(...arrays: any[][]): UnderscoreChain;
|
||||
|
||||
/**
|
||||
* Wrapped type `any[]`.
|
||||
* @see _.difference
|
||||
**/
|
||||
difference(...others: any[]): UnderscoreChain;
|
||||
|
||||
/**
|
||||
* Wrapped type `any[]`.
|
||||
* @see _.uniq
|
||||
**/
|
||||
uniq(
|
||||
isSorted?: bool,
|
||||
iterator?: (element: any, index?: number, list?: any[]) => any,
|
||||
context?: any): UnderscoreChain;
|
||||
/**
|
||||
* Wrapped type `any[]`.
|
||||
* @see _.uniq
|
||||
**/
|
||||
uniq(
|
||||
iterator?: (element: any, index?: number, list?: any[]) => any,
|
||||
context?: any): UnderscoreChain;
|
||||
|
||||
/**
|
||||
* Alias for 'uniq'.
|
||||
* @see uniq
|
||||
**/
|
||||
unique(
|
||||
isSorted?: bool,
|
||||
iterator?: (element: any, index?: number, list?: any[]) => any): UnderscoreChain;
|
||||
|
||||
/**
|
||||
* Wrapped type `any[][]`.
|
||||
* @see _.zip
|
||||
**/
|
||||
zip(...arrays: any[][]): UnderscoreChain;
|
||||
|
||||
/**
|
||||
* Wrapped type `any[][]`.
|
||||
* @see _.object
|
||||
**/
|
||||
object(...keyValuePairs: any[][]): UnderscoreChain;
|
||||
|
||||
/**
|
||||
* Wrapped type `any[]`.
|
||||
* @see _.indexOf
|
||||
**/
|
||||
indexOf(value: any, isSorted?: bool): UnderscoreChain;
|
||||
|
||||
/**
|
||||
* Wrapped type `any[]`.
|
||||
* @see _.lastIndexOf
|
||||
**/
|
||||
lastIndexOf(value: any, from?: number): UnderscoreChain;
|
||||
|
||||
/**
|
||||
* Wrapped type `any[]`.
|
||||
* @see _.sortedIndex
|
||||
**/
|
||||
sortedIndex(value: any, iterator?: (element: any) => number): UnderscoreChain;
|
||||
|
||||
/**
|
||||
* Wrapped type `number`.
|
||||
* @see _.range
|
||||
**/
|
||||
range(stop: number, step?: number): UnderscoreChain;
|
||||
/**
|
||||
* Wrapped type `number`.
|
||||
* @see _.range
|
||||
**/
|
||||
range(): UnderscoreChain;
|
||||
|
||||
/************
|
||||
* Functions *
|
||||
*************/
|
||||
|
||||
/**
|
||||
* Wrapped type `Function`.
|
||||
* @see _.bind
|
||||
**/
|
||||
bind(object: any, ...arguments: any[]): UnderscoreChain;
|
||||
|
||||
|
||||
/**
|
||||
* Wrapped type `object`.
|
||||
* @see _.bindAll
|
||||
**/
|
||||
bindAll(...methodNames: string[]): UnderscoreChain;
|
||||
|
||||
/**
|
||||
* Wrapped type `Function`.
|
||||
* @see _.partial
|
||||
**/
|
||||
partial(...arguments: any[]): UnderscoreChain;
|
||||
|
||||
/**
|
||||
* Wrapped type `Function`.
|
||||
* @see _.memoize
|
||||
**/
|
||||
memoize(hashFn?: (n: any) => string): UnderscoreChain;
|
||||
|
||||
/**
|
||||
* Wrapped type `Function`.
|
||||
* @see _.delay
|
||||
**/
|
||||
delay(waitMS: number, ...arguments: any[]): UnderscoreChain;
|
||||
|
||||
/**
|
||||
* Wrapped type `Function`.
|
||||
* @see _.defer
|
||||
**/
|
||||
defer(...arguments: any[]): UnderscoreChain;
|
||||
|
||||
/**
|
||||
* Wrapped type `Function`.
|
||||
* @see _.throttle
|
||||
**/
|
||||
throttle(waitMS: number): UnderscoreChain;
|
||||
|
||||
/**
|
||||
* Wrapped type `Function`.
|
||||
* @see _.debounce
|
||||
**/
|
||||
debounce(waitMS: number, immediate?: bool): UnderscoreChain;
|
||||
|
||||
/**
|
||||
* Wrapped type `Function`.
|
||||
* @see _.once
|
||||
**/
|
||||
once(): UnderscoreChain;
|
||||
|
||||
/**
|
||||
* Wrapped type `number`.
|
||||
* @see _.after
|
||||
**/
|
||||
after(fn: Function): UnderscoreChain;
|
||||
|
||||
/**
|
||||
* Wrapped type `Function`.
|
||||
* @see _.wrap
|
||||
**/
|
||||
wrap(wrapper: (fn: Function, ...args: any[]) => any): UnderscoreChain;
|
||||
|
||||
/**
|
||||
* Wrapped type `Function[]`.
|
||||
* @see _.compose
|
||||
**/
|
||||
compose(...functions: Function[]): UnderscoreChain;
|
||||
|
||||
/**********
|
||||
* Objects *
|
||||
***********/
|
||||
|
||||
/**
|
||||
* Wrapped type `object`.
|
||||
* @see _.keys
|
||||
**/
|
||||
keys(): UnderscoreChain;
|
||||
|
||||
/**
|
||||
* Wrapped type `object`.
|
||||
* @see _.values
|
||||
**/
|
||||
values(): UnderscoreChain;
|
||||
|
||||
/**
|
||||
* Wrapped type `object`.
|
||||
* @see _.pairs
|
||||
**/
|
||||
pairs(): UnderscoreChain;
|
||||
|
||||
/**
|
||||
* Wrapped type `object`.
|
||||
* @see _.invert
|
||||
**/
|
||||
invert(): UnderscoreChain;
|
||||
|
||||
/**
|
||||
* Wrapped type `object`.
|
||||
* @see _.functions
|
||||
**/
|
||||
functions(): UnderscoreChain;
|
||||
|
||||
/**
|
||||
* Wrapped type `object`.
|
||||
* @see _.extend
|
||||
**/
|
||||
extend(...sources: any[]): UnderscoreChain;
|
||||
|
||||
/**
|
||||
* Wrapped type `object`.
|
||||
* @see _.pick
|
||||
**/
|
||||
pick(...keys: string[]): UnderscoreChain;
|
||||
|
||||
/**
|
||||
* Wrapped type `object`.
|
||||
* @see _.omit
|
||||
**/
|
||||
omit(...keys: string[]): UnderscoreChain;
|
||||
|
||||
/**
|
||||
* Wrapped type `object`.
|
||||
* @see _.defaults
|
||||
**/
|
||||
defaults(...defaults: any[]): UnderscoreChain;
|
||||
|
||||
/**
|
||||
* Wrapped type `object`.
|
||||
* @see _.clone
|
||||
**/
|
||||
clone(object: any): UnderscoreChain;
|
||||
/**
|
||||
* Wrapped type `any[]`.
|
||||
* @see _.clone
|
||||
**/
|
||||
clone(list: any[]): UnderscoreChain;
|
||||
|
||||
/**
|
||||
* Wrapped type `object`.
|
||||
* @see _.tap
|
||||
**/
|
||||
tap(intercepter: Function): UnderscoreChain;
|
||||
|
||||
/**
|
||||
* Wrapped type `object`.
|
||||
* @see _.has
|
||||
**/
|
||||
has(key: string): UnderscoreChain;
|
||||
|
||||
/**
|
||||
* Wrapped type `object`.
|
||||
* @see _.isEqual
|
||||
**/
|
||||
isEqual(other: any): UnderscoreChain;
|
||||
|
||||
/**
|
||||
* Wrapped type `object`.
|
||||
* @see _.isEmpty
|
||||
**/
|
||||
isEmpty(object: any): UnderscoreChain;
|
||||
/**
|
||||
* Wrapped type `any[]`.
|
||||
* @see _.isEmpty
|
||||
**/
|
||||
isEmpty(list: any[]): UnderscoreChain;
|
||||
|
||||
/**
|
||||
* Wrapped type `object`.
|
||||
* @see _.isElement
|
||||
**/
|
||||
isElement(): UnderscoreChain;
|
||||
|
||||
/**
|
||||
* Wrapped type `object`.
|
||||
* @see _.isArray
|
||||
**/
|
||||
isArray(): UnderscoreChain;
|
||||
|
||||
/**
|
||||
* Wrapped type `object`.
|
||||
* @see _.isObject
|
||||
**/
|
||||
isObject(): UnderscoreChain;
|
||||
|
||||
/**
|
||||
* Wrapped type `object`.
|
||||
* @see _.isArguments
|
||||
**/
|
||||
isArguments(): UnderscoreChain;
|
||||
|
||||
/**
|
||||
* Wrapped type `object`.
|
||||
* @see _.isFunction
|
||||
**/
|
||||
isFunction(): UnderscoreChain;
|
||||
|
||||
/**
|
||||
* Wrapped type `object`.
|
||||
* @see _.isString
|
||||
**/
|
||||
isString(): UnderscoreChain;
|
||||
|
||||
/**
|
||||
* Wrapped type `object`.
|
||||
* @see _.isNumber
|
||||
**/
|
||||
isNumber(): UnderscoreChain;
|
||||
|
||||
/**
|
||||
* Wrapped type `object`.
|
||||
* @see _.isFinite
|
||||
**/
|
||||
isFinite(): UnderscoreChain;
|
||||
|
||||
/**
|
||||
* Wrapped type `object`.
|
||||
* @see _.isBoolean
|
||||
**/
|
||||
isBoolean(): UnderscoreChain;
|
||||
|
||||
/**
|
||||
* Wrapped type `object`.
|
||||
* @see _.isDate
|
||||
**/
|
||||
isDate(): UnderscoreChain;
|
||||
|
||||
/**
|
||||
* Wrapped type `object`.
|
||||
* @see _.isRegExp
|
||||
**/
|
||||
isRegExp(): UnderscoreChain;
|
||||
|
||||
/**
|
||||
* Wrapped type `object`.
|
||||
* @see _.isNaN
|
||||
**/
|
||||
isNaN(): UnderscoreChain;
|
||||
|
||||
/**
|
||||
* Wrapped type `object`.
|
||||
* @see _.isNull
|
||||
**/
|
||||
isNull(): UnderscoreChain;
|
||||
|
||||
/**
|
||||
* Wrapped type `object`.
|
||||
* @see _.isUndefined
|
||||
**/
|
||||
isUndefined(): UnderscoreChain;
|
||||
|
||||
/**********
|
||||
* Utility *
|
||||
***********/
|
||||
|
||||
/**
|
||||
* Wrapped type `any`.
|
||||
* @see _.identity
|
||||
**/
|
||||
identity(): UnderscoreChain;
|
||||
|
||||
/**
|
||||
* Wrapped type `number`.
|
||||
* @see _.times
|
||||
**/
|
||||
times(iterator: (n: number) => any, context?: any): UnderscoreChain;
|
||||
|
||||
/**
|
||||
* Wrapped type `number`.
|
||||
* @see _.random
|
||||
**/
|
||||
random(): UnderscoreChain;
|
||||
/**
|
||||
* Wrapped type `number`.
|
||||
* @see _.random
|
||||
**/
|
||||
random(max: number): UnderscoreChain;
|
||||
|
||||
/**
|
||||
* Wrapped type `object`.
|
||||
* @see _.mixin
|
||||
**/
|
||||
mixin(): UnderscoreChain;
|
||||
|
||||
/**
|
||||
* Wrapped type `string`.
|
||||
* @see _.uniqueId
|
||||
**/
|
||||
uniqueId(): UnderscoreChain;
|
||||
|
||||
/**
|
||||
* Wrapped type `string`.
|
||||
* @see _.escape
|
||||
**/
|
||||
escape(): UnderscoreChain;
|
||||
|
||||
/**
|
||||
* Wrapped type `object`.
|
||||
* @see _.result
|
||||
**/
|
||||
result(property: string): UnderscoreChain;
|
||||
|
||||
/**
|
||||
* Wrapped type `string`.
|
||||
* @see _.template
|
||||
**/
|
||||
template(data?: any, settings?: UnderscoreTemplateSettings): UnderscoreChain;
|
||||
|
||||
/***********
|
||||
* Chaining *
|
||||
************/
|
||||
|
||||
/**
|
||||
* Wrapped type `any`.
|
||||
* @see _.chain
|
||||
**/
|
||||
chain(): UnderscoreChain;
|
||||
|
||||
/**
|
||||
* Wrapped type `any`.
|
||||
|
||||
Vendored
+231
-231
@@ -1,232 +1,232 @@
|
||||
// Type definitions for Underscore 1.4
|
||||
// Project: http://underscorejs.org/
|
||||
// Definitions by: Boris Yankov <https://github.com/borisyankov/>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
|
||||
interface UnderscoreWrappedObject {
|
||||
value () : any;
|
||||
filter(arg?) : any;
|
||||
}
|
||||
|
||||
interface TemplateSettings {
|
||||
evaluate?: RegExp;
|
||||
interpolate?: RegExp;
|
||||
escape?: RegExp;
|
||||
}
|
||||
|
||||
interface ListIterator {
|
||||
(value, key, list?): void;
|
||||
}
|
||||
|
||||
interface ObjectIterator {
|
||||
(element, index, list?): void;
|
||||
}
|
||||
|
||||
// Common interface between Arrays and jQuery objects
|
||||
interface List {
|
||||
[index: number]: any;
|
||||
length: number;
|
||||
}
|
||||
|
||||
interface UnderscoreStatic {
|
||||
(arg?:any) : any;
|
||||
|
||||
/****
|
||||
Collections
|
||||
*****/
|
||||
each(list: List, iterator: ListIterator, context?: any): any[];
|
||||
each(object: any, iterator: ObjectIterator, context?: any): any[];
|
||||
forEach(list: List, iterator: ObjectIterator, context?: any): any[];
|
||||
forEach(object: any, iterator: ListIterator, context?: any): any[];
|
||||
|
||||
map(list: List, iterator: ListIterator, context?: any): any[];
|
||||
map(object: any, iterator: ObjectIterator, context?: any): any[];
|
||||
collect(list: List, iterator: ListIterator, context?: any): any[];
|
||||
collect(object: any, iterator: ObjectIterator, context?: any): any[];
|
||||
|
||||
reduce(list: List, iterator: any, memo: any, context?: any): any[];
|
||||
reduce(list: any[], iterator: any, memo: any, context?: any): any[];
|
||||
inject(list: List, iterator: any, memo: any, context?: any): any[];
|
||||
inject(list: any[], iterator: any, memo: any, context?: any): any[];
|
||||
foldl(list: List, iterator: any, memo: any, context?: any): any[];
|
||||
foldl(list: any[], iterator: any, memo: any, context?: any): any[];
|
||||
|
||||
reduceRight(list: List, iterator: any, memo: any, context?: any): any[];
|
||||
reduceRight(list: any[], iterator: any, memo: any, context?: any): any[];
|
||||
foldr(list: List, iterator: any, memo: any, context?: any): any[];
|
||||
foldr(list: any[], iterator: any, memo: any, context?: any): any[];
|
||||
|
||||
find(list: List, iterator: any, context?: any): any;
|
||||
find(list: any[], iterator: any, context?: any): any;
|
||||
detect(list: List, iterator: any, context?: any): any;
|
||||
detect(list: any[], iterator: any, context?: any): any;
|
||||
|
||||
filter(list: List, iterator: any, context?: any): any[];
|
||||
filter(list: any[], iterator: any, context?: any): any[];
|
||||
select(list: List, iterator: any, context?: any): any[];
|
||||
select(list: any[], iterator: any, context?: any): any[];
|
||||
|
||||
where(list: List, properties: any): any[];
|
||||
where(list: any[], properties: any): any[];
|
||||
|
||||
reject(list: List, iterator: any, context?: any): any[];
|
||||
reject(list: any[], iterator: any, context?: any): any[];
|
||||
|
||||
all(list: List, iterator: any, context?: any): bool;
|
||||
all(list: any[], iterator: any, context?: any): bool;
|
||||
every(list: List, iterator: any, context?: any): bool;
|
||||
every(list: any[], iterator: any, context?: any): bool;
|
||||
|
||||
any(list: List, iterator?: any, context?: any): bool;
|
||||
any(list: any[], iterator?: any, context?: any): bool;
|
||||
some(list: List, iterator?: any, context?: any): bool;
|
||||
some(list: any[], iterator?: any, context?: any): bool;
|
||||
|
||||
contains(list: any, value: any): bool;
|
||||
contains(list: List, value: any): bool;
|
||||
include(list: any, value: any): bool;
|
||||
include(list: List, value: any): bool;
|
||||
|
||||
invoke(list: List, methodName: string, arguments: any[]): any;
|
||||
invoke(object: any, methodName: string, ...arguments: any[]): any;
|
||||
|
||||
pluck(list: List, propertyName: string): string[];
|
||||
pluck(list: any[], propertyName: string): string[];
|
||||
max(list: List, iterator?: any, context?: any): any;
|
||||
max(list: any[], iterator?: any, context?: any): any;
|
||||
min(list: List, iterator?: any, context?: any): any;
|
||||
min(list: any[], iterator?: any, context?: any): any;
|
||||
sortBy(list: List, iterator?: any, context?: any): any;
|
||||
sortBy(list: any[], iterator?: any, context?: any): any;
|
||||
groupBy(list: List, iterator: any): any;
|
||||
groupBy(list: any[], iterator: any): any;
|
||||
countBy(list: List, iterator: any): any;
|
||||
countBy(list: any[], iterator: any): any;
|
||||
shuffle(list: any[]): any[];
|
||||
toArray(list: any): any[];
|
||||
size(list: any): number;
|
||||
|
||||
/****
|
||||
Arrays
|
||||
*****/
|
||||
first(array: List, n?: number): any;
|
||||
first(array: any[], n?: number): any;
|
||||
head(array: List, n?: number): any;
|
||||
head(array: any[], n?: number): any;
|
||||
take(array: List, n?: number): any;
|
||||
take(array: any[], n?: number): any;
|
||||
|
||||
initial(array: List, n?: number): any[];
|
||||
initial(array: any[], n?: number): any[];
|
||||
|
||||
last(array: List, n?: number): any;
|
||||
last(array: any[], n?: number): any;
|
||||
|
||||
rest(array: List, n?: number): any[];
|
||||
rest(array: any[], n?: number): any[];
|
||||
tail(array: List, n?: number): any[];
|
||||
tail(array: any[], n?: number): any[];
|
||||
drop(array: List, n?: number): any[];
|
||||
drop(array: any[], n?: number): any[];
|
||||
|
||||
compact(array: any[]): any[];
|
||||
flatten(array: List, shallow?: bool): any[];
|
||||
flatten(array: any[], shallow?: bool): any[];
|
||||
without(array: List, ...values: any[]): any[];
|
||||
without(array: any[], ...values: any[]): any[];
|
||||
union(...arrays: any[][]): any[];
|
||||
intersection(...arrays: any[][]): any[];
|
||||
difference(array: List, ...others: any[][]): any[];
|
||||
difference(array: any[], ...others: any[][]): any[];
|
||||
|
||||
uniq(array: List, isSorted?: bool, iterator?: any): any[];
|
||||
uniq(array: any[], isSorted?: bool, iterator?: any): any[];
|
||||
unique(array: List, isSorted?: bool, iterator?: any): any[];
|
||||
unique(array: any[], isSorted?: bool, iterator?: any): any[];
|
||||
|
||||
zip(...arrays: any[]): any[];
|
||||
object(list: List, values?: any[]): any;
|
||||
object(list: any[], values?: any[]): any;
|
||||
indexOf(array: List, value: any, isSorted?: bool): number;
|
||||
indexOf(array: any[], value: any, isSorted?: bool): number;
|
||||
lastIndexOf(array: List, value: any, fromIndex?: number): number;
|
||||
lastIndexOf(array: any[], value: any, fromIndex?: number): number;
|
||||
sortedIndex(list: List, valueL: any, iterator?: any): number;
|
||||
sortedIndex(list: any[], valueL: any, iterator?: any): number;
|
||||
range(stop: number): any[];
|
||||
range(start: number, stop: number, step?: number): any[];
|
||||
|
||||
/****
|
||||
Functions
|
||||
*****/
|
||||
bind(func: (...as : any[]) => any, context: any, ...arguments: any[]): () => any;
|
||||
bindAll(object: any, ...methodNames: string[]): any;
|
||||
memoize(func: any, hashFunction?: any): any;
|
||||
defer(func: () => any);
|
||||
delay(func: any, wait: number, ...arguments: any[]): any;
|
||||
delay(func: any, ...arguments: any[]): any;
|
||||
throttle(func: any, wait: number): any;
|
||||
debounce(func: any, wait: number, immediate?: bool): any;
|
||||
once(func: any): any;
|
||||
after(count: number, func: any): any;
|
||||
wrap(func: (...as : any[]) => any, wrapper: any): () => any;
|
||||
compose(...functions: any[]): any;
|
||||
|
||||
/****
|
||||
Objects
|
||||
*****/
|
||||
keys(object: any): any[];
|
||||
values(object: any): any[];
|
||||
pairs(object: any): any[];
|
||||
invert(object: any): any;
|
||||
|
||||
functions(object: any): string[];
|
||||
methods(object: any): string[];
|
||||
|
||||
extend(destination: any, ...sources: any[]): any;
|
||||
pick(object: any, ...keys: string[]): any;
|
||||
omit(object: any, ...keys: string[]): any;
|
||||
defaults(object: any, ...defaults: any[]): any;
|
||||
clone(object: any): any;
|
||||
tap(object: any, interceptor: (...as : any[]) => any): any;
|
||||
has(object: any, key: string): bool;
|
||||
isEqual(object: any, other: any): bool;
|
||||
isEmpty(object: any): bool;
|
||||
isElement(object: any): bool;
|
||||
isArray(object: any): bool;
|
||||
isObject(value: any): bool;
|
||||
isArguments(object: any): bool;
|
||||
isFunction(object: any): bool;
|
||||
isString(object: any): bool;
|
||||
isNumber(object: any): bool;
|
||||
isFinite(object: any): bool;
|
||||
isBoolean(object: any): bool;
|
||||
isDate(object: any): bool;
|
||||
isRegExp(object: any): bool;
|
||||
isNaN(object: any): bool;
|
||||
isNull(object: any): bool;
|
||||
isUndefined(value: any): bool;
|
||||
|
||||
/****
|
||||
Utility
|
||||
*****/
|
||||
noConflict(): any;
|
||||
identity(value: any): any;
|
||||
times(n: number, iterator: (index : number) => void, context?: any): void;
|
||||
random(min: number, max: number): number;
|
||||
mixin(object: any): void;
|
||||
uniqueId(prefix: string): string;
|
||||
uniqueId(): number;
|
||||
escape(str: string): string;
|
||||
result(object: any, property: string): any;
|
||||
templateSettings: TemplateSettings;
|
||||
template(templateString: string, data?: any, settings?: any): (...data: any[]) => string;
|
||||
|
||||
/****
|
||||
Chaining
|
||||
*****/
|
||||
chain(object: any): UnderscoreWrappedObject;
|
||||
}
|
||||
|
||||
// Type definitions for Underscore 1.4
|
||||
// Project: http://underscorejs.org/
|
||||
// Definitions by: Boris Yankov <https://github.com/borisyankov/>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
|
||||
interface UnderscoreWrappedObject {
|
||||
value () : any;
|
||||
filter(arg?) : any;
|
||||
}
|
||||
|
||||
interface TemplateSettings {
|
||||
evaluate?: RegExp;
|
||||
interpolate?: RegExp;
|
||||
escape?: RegExp;
|
||||
}
|
||||
|
||||
interface ListIterator {
|
||||
(value, key, list?): void;
|
||||
}
|
||||
|
||||
interface ObjectIterator {
|
||||
(element, index, list?): void;
|
||||
}
|
||||
|
||||
// Common interface between Arrays and jQuery objects
|
||||
interface List {
|
||||
[index: number]: any;
|
||||
length: number;
|
||||
}
|
||||
|
||||
interface UnderscoreStatic {
|
||||
(arg?:any) : any;
|
||||
|
||||
/****
|
||||
Collections
|
||||
*****/
|
||||
each(list: List, iterator: ListIterator, context?: any): any[];
|
||||
each(object: any, iterator: ObjectIterator, context?: any): any[];
|
||||
forEach(list: List, iterator: ObjectIterator, context?: any): any[];
|
||||
forEach(object: any, iterator: ListIterator, context?: any): any[];
|
||||
|
||||
map(list: List, iterator: ListIterator, context?: any): any[];
|
||||
map(object: any, iterator: ObjectIterator, context?: any): any[];
|
||||
collect(list: List, iterator: ListIterator, context?: any): any[];
|
||||
collect(object: any, iterator: ObjectIterator, context?: any): any[];
|
||||
|
||||
reduce(list: List, iterator: any, memo: any, context?: any): any;
|
||||
reduce(list: any[], iterator: any, memo: any, context?: any): any;
|
||||
inject(list: List, iterator: any, memo: any, context?: any): any;
|
||||
inject(list: any[], iterator: any, memo: any, context?: any): any;
|
||||
foldl(list: List, iterator: any, memo: any, context?: any): any;
|
||||
foldl(list: any[], iterator: any, memo: any, context?: any): any;
|
||||
|
||||
reduceRight(list: List, iterator: any, memo: any, context?: any): any[];
|
||||
reduceRight(list: any[], iterator: any, memo: any, context?: any): any[];
|
||||
foldr(list: List, iterator: any, memo: any, context?: any): any[];
|
||||
foldr(list: any[], iterator: any, memo: any, context?: any): any[];
|
||||
|
||||
find(list: List, iterator: any, context?: any): any;
|
||||
find(list: any[], iterator: any, context?: any): any;
|
||||
detect(list: List, iterator: any, context?: any): any;
|
||||
detect(list: any[], iterator: any, context?: any): any;
|
||||
|
||||
filter(list: List, iterator: any, context?: any): any[];
|
||||
filter(list: any[], iterator: any, context?: any): any[];
|
||||
select(list: List, iterator: any, context?: any): any[];
|
||||
select(list: any[], iterator: any, context?: any): any[];
|
||||
|
||||
where(list: List, properties: any): any[];
|
||||
where(list: any[], properties: any): any[];
|
||||
|
||||
reject(list: List, iterator: any, context?: any): any[];
|
||||
reject(list: any[], iterator: any, context?: any): any[];
|
||||
|
||||
all(list: List, iterator: any, context?: any): bool;
|
||||
all(list: any[], iterator: any, context?: any): bool;
|
||||
every(list: List, iterator: any, context?: any): bool;
|
||||
every(list: any[], iterator: any, context?: any): bool;
|
||||
|
||||
any(list: List, iterator?: any, context?: any): bool;
|
||||
any(list: any[], iterator?: any, context?: any): bool;
|
||||
some(list: List, iterator?: any, context?: any): bool;
|
||||
some(list: any[], iterator?: any, context?: any): bool;
|
||||
|
||||
contains(list: any, value: any): bool;
|
||||
contains(list: List, value: any): bool;
|
||||
include(list: any, value: any): bool;
|
||||
include(list: List, value: any): bool;
|
||||
|
||||
invoke(list: List, methodName: string, arguments: any[]): any;
|
||||
invoke(object: any, methodName: string, ...arguments: any[]): any;
|
||||
|
||||
pluck(list: List, propertyName: string): string[];
|
||||
pluck(list: any[], propertyName: string): string[];
|
||||
max(list: List, iterator?: any, context?: any): any;
|
||||
max(list: any[], iterator?: any, context?: any): any;
|
||||
min(list: List, iterator?: any, context?: any): any;
|
||||
min(list: any[], iterator?: any, context?: any): any;
|
||||
sortBy(list: List, iterator?: any, context?: any): any;
|
||||
sortBy(list: any[], iterator?: any, context?: any): any;
|
||||
groupBy(list: List, iterator: any): any;
|
||||
groupBy(list: any[], iterator: any): any;
|
||||
countBy(list: List, iterator: any): any;
|
||||
countBy(list: any[], iterator: any): any;
|
||||
shuffle(list: any[]): any[];
|
||||
toArray(list: any): any[];
|
||||
size(list: any): number;
|
||||
|
||||
/****
|
||||
Arrays
|
||||
*****/
|
||||
first(array: List, n?: number): any;
|
||||
first(array: any[], n?: number): any;
|
||||
head(array: List, n?: number): any;
|
||||
head(array: any[], n?: number): any;
|
||||
take(array: List, n?: number): any;
|
||||
take(array: any[], n?: number): any;
|
||||
|
||||
initial(array: List, n?: number): any[];
|
||||
initial(array: any[], n?: number): any[];
|
||||
|
||||
last(array: List, n?: number): any;
|
||||
last(array: any[], n?: number): any;
|
||||
|
||||
rest(array: List, n?: number): any[];
|
||||
rest(array: any[], n?: number): any[];
|
||||
tail(array: List, n?: number): any[];
|
||||
tail(array: any[], n?: number): any[];
|
||||
drop(array: List, n?: number): any[];
|
||||
drop(array: any[], n?: number): any[];
|
||||
|
||||
compact(array: any[]): any[];
|
||||
flatten(array: List, shallow?: bool): any[];
|
||||
flatten(array: any[], shallow?: bool): any[];
|
||||
without(array: List, ...values: any[]): any[];
|
||||
without(array: any[], ...values: any[]): any[];
|
||||
union(...arrays: any[][]): any[];
|
||||
intersection(...arrays: any[][]): any[];
|
||||
difference(array: List, ...others: any[][]): any[];
|
||||
difference(array: any[], ...others: any[][]): any[];
|
||||
|
||||
uniq(array: List, isSorted?: bool, iterator?: any): any[];
|
||||
uniq(array: any[], isSorted?: bool, iterator?: any): any[];
|
||||
unique(array: List, isSorted?: bool, iterator?: any): any[];
|
||||
unique(array: any[], isSorted?: bool, iterator?: any): any[];
|
||||
|
||||
zip(...arrays: any[]): any[];
|
||||
object(list: List, values?: any[]): any;
|
||||
object(list: any[], values?: any[]): any;
|
||||
indexOf(array: List, value: any, isSorted?: bool): number;
|
||||
indexOf(array: any[], value: any, isSorted?: bool): number;
|
||||
lastIndexOf(array: List, value: any, fromIndex?: number): number;
|
||||
lastIndexOf(array: any[], value: any, fromIndex?: number): number;
|
||||
sortedIndex(list: List, valueL: any, iterator?: any): number;
|
||||
sortedIndex(list: any[], valueL: any, iterator?: any): number;
|
||||
range(stop: number): any[];
|
||||
range(start: number, stop: number, step?: number): any[];
|
||||
|
||||
/****
|
||||
Functions
|
||||
*****/
|
||||
bind(func: (...as : any[]) => any, context: any, ...arguments: any[]): () => any;
|
||||
bindAll(object: any, ...methodNames: string[]): any;
|
||||
memoize(func: any, hashFunction?: any): any;
|
||||
defer(func: () => any);
|
||||
delay(func: any, wait: number, ...arguments: any[]): any;
|
||||
delay(func: any, ...arguments: any[]): any;
|
||||
throttle(func: any, wait: number): any;
|
||||
debounce(func: any, wait: number, immediate?: bool): any;
|
||||
once(func: any): any;
|
||||
after(count: number, func: any): any;
|
||||
wrap(func: (...as : any[]) => any, wrapper: any): () => any;
|
||||
compose(...functions: any[]): any;
|
||||
|
||||
/****
|
||||
Objects
|
||||
*****/
|
||||
keys(object: any): any[];
|
||||
values(object: any): any[];
|
||||
pairs(object: any): any[];
|
||||
invert(object: any): any;
|
||||
|
||||
functions(object: any): string[];
|
||||
methods(object: any): string[];
|
||||
|
||||
extend(destination: any, ...sources: any[]): any;
|
||||
pick(object: any, ...keys: string[]): any;
|
||||
omit(object: any, ...keys: string[]): any;
|
||||
defaults(object: any, ...defaults: any[]): any;
|
||||
clone(object: any): any;
|
||||
tap(object: any, interceptor: (...as : any[]) => any): any;
|
||||
has(object: any, key: string): bool;
|
||||
isEqual(object: any, other: any): bool;
|
||||
isEmpty(object: any): bool;
|
||||
isElement(object: any): bool;
|
||||
isArray(object: any): bool;
|
||||
isObject(value: any): bool;
|
||||
isArguments(object: any): bool;
|
||||
isFunction(object: any): bool;
|
||||
isString(object: any): bool;
|
||||
isNumber(object: any): bool;
|
||||
isFinite(object: any): bool;
|
||||
isBoolean(object: any): bool;
|
||||
isDate(object: any): bool;
|
||||
isRegExp(object: any): bool;
|
||||
isNaN(object: any): bool;
|
||||
isNull(object: any): bool;
|
||||
isUndefined(value: any): bool;
|
||||
|
||||
/****
|
||||
Utility
|
||||
*****/
|
||||
noConflict(): any;
|
||||
identity(value: any): any;
|
||||
times(n: number, iterator: (index : number) => void, context?: any): void;
|
||||
random(min: number, max: number): number;
|
||||
mixin(object: any): void;
|
||||
uniqueId(prefix: string): string;
|
||||
uniqueId(): number;
|
||||
escape(str: string): string;
|
||||
result(object: any, property: string): any;
|
||||
templateSettings: TemplateSettings;
|
||||
template(templateString: string, data?: any, settings?: any): (...data: any[]) => string;
|
||||
|
||||
/****
|
||||
Chaining
|
||||
*****/
|
||||
chain(object: any): UnderscoreWrappedObject;
|
||||
}
|
||||
|
||||
declare var _: UnderscoreStatic;
|
||||
Vendored
+247
@@ -0,0 +1,247 @@
|
||||
// Type definitions for the Web Audio API, currently only implemented in WebKit browsers
|
||||
// Conforms to the: http://www.w3.org/TR/2012/WD-webaudio-20120802/ specification
|
||||
// Definitions by: Baruch Berger (https://github.com/bbss)
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
interface webkitAudioContext {
|
||||
destination: AudioDestinationNode;
|
||||
sampleRate: number;
|
||||
currentTime: number;
|
||||
listener: AudioListener;
|
||||
activeSourceCount: number;
|
||||
|
||||
createBuffer(numberOfChannels: number, length: number, sampleRate: number): AudioBuffer;
|
||||
createBuffer(buffer: ArrayBuffer, mixToMono: bool): AudioBuffer;
|
||||
|
||||
decodeAudioData(audioData: ArrayBuffer, successCallback: any, errorCallback?: any): void;
|
||||
|
||||
createBufferSource(): AudioBufferSourceNode;
|
||||
|
||||
createMediaElementSource(mediaElement: HTMLMediaElement): MediaElementAudioSourceNode;
|
||||
|
||||
createMediaStreamSource(mediaStream: any): MediaStreamAudioSourceNode;
|
||||
|
||||
createAnalyser(): RealtimeAnalyserNode;
|
||||
createGainNode(): AudioGainNode;
|
||||
createDelayNode(maxDelayTime?: number): DelayNode;
|
||||
createBiquadFilter(): BiquadFilterNode;
|
||||
createPanner():AudioPannerNode;
|
||||
createConvolver(): ConvolverNode;
|
||||
|
||||
createChannelSplitter(numberOfOutputs?: number):AudioChannelSplitter;
|
||||
createChannelMerger(numberOfInputs?: number): AudioChannelMerger;
|
||||
|
||||
createDynamicsCompressor(): DynamicsCompressorNode;
|
||||
|
||||
createOscillator(): Oscillator;
|
||||
createWaveTable(real: any,imag: any): WaveTable;
|
||||
}
|
||||
|
||||
declare var webkitAudioContext: {
|
||||
|
||||
new (): webkitAudioContext;
|
||||
|
||||
}
|
||||
|
||||
interface Oscillator extends AudioSourceNode {
|
||||
|
||||
type: number;
|
||||
playbackState: number;
|
||||
frequency: AudioParam;
|
||||
detune: AudioParam;
|
||||
noteOn(when: number): void;
|
||||
noteOff(when: number): void;
|
||||
setWaveTable(waveTable: WaveTable): void;
|
||||
|
||||
}
|
||||
|
||||
interface AudioDestinationNode extends AudioNode {
|
||||
|
||||
maxNumberOfChannels: number;
|
||||
numberOfChannels: number;
|
||||
|
||||
}
|
||||
|
||||
interface AudioNode {
|
||||
|
||||
connect(destination: AudioNode, output?: number, input?: number): void;
|
||||
connect(destination: AudioParam, output?: number): void;
|
||||
disconnect(output?: number): void;
|
||||
context: webkitAudioContext;
|
||||
numberOfInputs: number;
|
||||
numberOfOutputs: number;
|
||||
|
||||
};
|
||||
|
||||
interface AudioSourceNode extends AudioNode {
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
interface AudioParam {
|
||||
|
||||
value: number;
|
||||
minValue: number;
|
||||
maxValue: number;
|
||||
defaultValue: number;
|
||||
setValueAtTime(value: number, time: number): void;
|
||||
linearRampToValueAtTime(value: number, time: number): void;
|
||||
exponentialRampToValueAtTime(value: number, time: number): void;
|
||||
setTargetValueAtTime(targetValue: number,time: number, timeConstant: number): void;
|
||||
setValueCurveAtTime(values: number[], time: number, duration: number): void;
|
||||
cancelScheduledValues(startTime: number): void;
|
||||
|
||||
}
|
||||
|
||||
interface AudioGain extends AudioParam {
|
||||
|
||||
}
|
||||
|
||||
interface AudioGainNode extends AudioNode {
|
||||
|
||||
gain: AudioGain;
|
||||
|
||||
}
|
||||
|
||||
interface DelayNode extends AudioNode {
|
||||
|
||||
delayTime: AudioParam;
|
||||
|
||||
}
|
||||
|
||||
interface AudioBuffer {
|
||||
|
||||
sampleRate: number;
|
||||
length: number;
|
||||
duration: number;
|
||||
numberOfChannels: number;
|
||||
getChannelData(channel: number): any;
|
||||
|
||||
}
|
||||
|
||||
interface AudioBufferSourceNode extends AudioSourceNode {
|
||||
|
||||
playbackState: number;
|
||||
buffer: AudioBuffer;
|
||||
playbackRate: AudioParam;
|
||||
loop: bool;
|
||||
noteOn(when: number): void;
|
||||
noteGrainOn(when: number, grainOffset: number, grainDuration: number): void;
|
||||
noteOff(when: number): void;
|
||||
|
||||
}
|
||||
|
||||
interface MediaElementAudioSourceNode extends AudioSourceNode {
|
||||
|
||||
}
|
||||
|
||||
interface JavaScriptAudioNode extends AudioNode {
|
||||
|
||||
onaudioprocess: EventListener;
|
||||
bufferSize: number;
|
||||
|
||||
}
|
||||
|
||||
interface AudioProcessingEvent extends Event {
|
||||
|
||||
node: JavaScriptAudioNode;
|
||||
playbackTime: number;
|
||||
inputBuffer: AudioBuffer;
|
||||
outputBuffer: AudioBuffer;
|
||||
|
||||
}
|
||||
|
||||
interface AudioPannerNode extends AudioNode {
|
||||
|
||||
panningModel: number;
|
||||
setPosition(x: number, y: number, z: number): void;
|
||||
setOrientation(x: number, y: number, z: number): void;
|
||||
setVelocity(x: number, y: number, z: number): void;
|
||||
distanceModel: number;
|
||||
refDistance: number;
|
||||
maxDistance: number;
|
||||
rolloffFactor: number;
|
||||
coneInnerAngle: number;
|
||||
coneOuterAngle: number;
|
||||
coneOuterGain: number;
|
||||
distanceGain: AudioGain;
|
||||
coneGain: AudioGain;
|
||||
|
||||
}
|
||||
|
||||
interface AudioListener {
|
||||
|
||||
dopplerFactor: number;
|
||||
speedOfSound: number;
|
||||
setPosition(x: number, y: number, z: number): void;
|
||||
setOrientation(x: number, y: number, z: number, xUp: number, yUp: number, zUp: number): void;
|
||||
setVelocity(x: number, y: number, z: number): void;
|
||||
|
||||
}
|
||||
|
||||
interface RealtimeAnalyserNode extends AudioNode {
|
||||
|
||||
getFloatFrequencyData(array: any): void;
|
||||
getByteFrequencyData(array: any): void;
|
||||
getByteTimeDomainData(array: any): void;
|
||||
fftSize: number;
|
||||
frequencyBinCount: number;
|
||||
minDecibels: number;
|
||||
maxDecibels: number;
|
||||
smoothingTimeConstant: number;
|
||||
|
||||
}
|
||||
|
||||
interface AudioChannelSplitter extends AudioNode {
|
||||
|
||||
}
|
||||
|
||||
interface AudioChannelMerger extends AudioNode {
|
||||
|
||||
}
|
||||
|
||||
interface DynamicsCompressorNode extends AudioNode {
|
||||
|
||||
threshold: AudioParam;
|
||||
knee: AudioParam;
|
||||
ratio: AudioParam;
|
||||
reduction: AudioParam;
|
||||
attack: AudioParam;
|
||||
release: AudioParam;
|
||||
|
||||
}
|
||||
|
||||
interface BiquadFilterNode extends AudioNode {
|
||||
|
||||
type: number;
|
||||
frequency: AudioParam;
|
||||
Q: AudioParam;
|
||||
gain: AudioParam;
|
||||
|
||||
getFrequencyResponse(frequencyHz: any, magResponse: any, phaseResponse: any): void;
|
||||
|
||||
}
|
||||
|
||||
interface WaveShaperNode extends AudioNode {
|
||||
|
||||
curve: any;
|
||||
|
||||
}
|
||||
|
||||
interface MediaStreamAudioSourceNode extends AudioSourceNode {
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
interface ConvolverNode extends AudioNode {
|
||||
|
||||
buffer: AudioBuffer;
|
||||
normalize: bool;
|
||||
|
||||
}
|
||||
|
||||
interface WaveTable {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,305 @@
|
||||
// http://www.w3.org/TR/2012/WD-webaudio-20121213/
|
||||
|
||||
/// <reference path="waa.d.ts" />
|
||||
|
||||
declare var dogBarkingBuffer: any;
|
||||
|
||||
()=>{
|
||||
var context = new AudioContext();
|
||||
|
||||
function playSound() {
|
||||
var source = context.createBufferSource();
|
||||
source.buffer = dogBarkingBuffer;
|
||||
source.connect(context.destination);
|
||||
source.start(0);
|
||||
}
|
||||
};
|
||||
|
||||
declare var manTalkingBuffer: any;
|
||||
declare var footstepsBuffer: any;
|
||||
|
||||
()=>{
|
||||
|
||||
var context = new AudioContext();
|
||||
|
||||
// Create the effects nodes.
|
||||
var lowpassFilter = context.createBiquadFilter();
|
||||
var waveShaper = context.createWaveShaper();
|
||||
var panner = context.createPanner();
|
||||
var compressor = context.createDynamicsCompressor();
|
||||
var reverb = context.createConvolver();
|
||||
|
||||
// Create master wet and dry.
|
||||
var masterDry = context.createGain();
|
||||
var masterWet = context.createGain();
|
||||
|
||||
// Connect final compressor to final destination.
|
||||
compressor.connect(context.destination);
|
||||
|
||||
// Connect master dry and wet to compressor.
|
||||
masterDry.connect(compressor);
|
||||
masterWet.connect(compressor);
|
||||
|
||||
// Connect reverb to master wet.
|
||||
reverb.connect(masterWet);
|
||||
|
||||
// Create a few sources.
|
||||
var source1 = context.createBufferSource();
|
||||
var source2 = context.createBufferSource();
|
||||
var source3 = context.createOscillator();
|
||||
|
||||
source1.buffer = manTalkingBuffer;
|
||||
source2.buffer = footstepsBuffer;
|
||||
source3.frequency.value = 440;
|
||||
|
||||
// Connect source1
|
||||
var dry1 = context.createGain();
|
||||
var wet1 = context.createGain();
|
||||
source1.connect(lowpassFilter);
|
||||
lowpassFilter.connect(dry1);
|
||||
lowpassFilter.connect(wet1);
|
||||
dry1.connect(masterDry);
|
||||
wet1.connect(reverb);
|
||||
|
||||
// Connect source2
|
||||
var dry2 = context.createGain();
|
||||
var wet2 = context.createGain();
|
||||
source2.connect(waveShaper);
|
||||
waveShaper.connect(dry2);
|
||||
waveShaper.connect(wet2);
|
||||
dry2.connect(masterDry);
|
||||
wet2.connect(reverb);
|
||||
|
||||
// Connect source3
|
||||
var dry3 = context.createGain();
|
||||
var wet3 = context.createGain();
|
||||
source3.connect(panner);
|
||||
panner.connect(dry3);
|
||||
panner.connect(wet3);
|
||||
dry3.connect(masterDry);
|
||||
wet3.connect(reverb);
|
||||
|
||||
// Start the sources now.
|
||||
source1.start(0);
|
||||
source2.start(0);
|
||||
source3.start(0);
|
||||
};
|
||||
|
||||
()=>{
|
||||
var context: AudioContext;
|
||||
var compressor: DynamicsCompressorNode;
|
||||
var gainNode1: GainNode;
|
||||
var streamingAudioSource: MediaElementAudioSourceNode;
|
||||
|
||||
// Initial setup of the "long-lived" part of the routing graph
|
||||
function setupAudioContext() {
|
||||
context = new AudioContext();
|
||||
|
||||
compressor = context.createDynamicsCompressor();
|
||||
gainNode1 = context.createGain();
|
||||
|
||||
// Create a streaming audio source.
|
||||
var audioElement = <HTMLAudioElement> document.getElementById('audioTagID');
|
||||
streamingAudioSource = context.createMediaElementSource(audioElement);
|
||||
streamingAudioSource.connect(gainNode1);
|
||||
|
||||
gainNode1.connect(compressor);
|
||||
compressor.connect(context.destination);
|
||||
}
|
||||
|
||||
// Later in response to some user action (typically mouse or key event)
|
||||
// a one-shot sound can be played.
|
||||
function playSound() {
|
||||
var oneShotSound = context.createBufferSource();
|
||||
oneShotSound.buffer = dogBarkingBuffer;
|
||||
|
||||
// Create a filter, panner, and gain node.
|
||||
var lowpass = context.createBiquadFilter();
|
||||
var panner = context.createPanner();
|
||||
var gainNode2 = context.createGain();
|
||||
|
||||
// Make connections
|
||||
oneShotSound.connect(lowpass);
|
||||
lowpass.connect(panner);
|
||||
panner.connect(gainNode2);
|
||||
gainNode2.connect(compressor);
|
||||
|
||||
// Play 0.75 seconds from now (to play immediately pass in 0)
|
||||
oneShotSound.start(context.currentTime + 0.75);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
()=>{
|
||||
var param:AudioParam;
|
||||
|
||||
var t0 = 0;
|
||||
var t1 = 0.1;
|
||||
var t2 = 0.2;
|
||||
var t3 = 0.3;
|
||||
var t4 = 0.4;
|
||||
var t5 = 0.6;
|
||||
var t6 = 0.7;
|
||||
var t7 = 1.0;
|
||||
|
||||
var curveLength = 44100;
|
||||
var curve = new Float32Array(curveLength);
|
||||
for (var i = 0; i < curveLength; ++i)
|
||||
curve[i] = Math.sin(Math.PI * i / curveLength);
|
||||
|
||||
param.setValueAtTime(0.2, t0);
|
||||
param.setValueAtTime(0.3, t1);
|
||||
param.setValueAtTime(0.4, t2);
|
||||
param.linearRampToValueAtTime(1, t3);
|
||||
param.linearRampToValueAtTime(0.15, t4);
|
||||
param.exponentialRampToValueAtTime(0.75, t5);
|
||||
param.exponentialRampToValueAtTime(0.05, t6);
|
||||
param.setValueCurveAtTime(curve, t6, t7 - t6);
|
||||
|
||||
};
|
||||
|
||||
()=>{
|
||||
var param: AudioParam;
|
||||
|
||||
var t0 = 0;
|
||||
var t1 = 0.1;
|
||||
var t2 = 0.2;
|
||||
var t3 = 0.3;
|
||||
var t4 = 0.4;
|
||||
var t5 = 0.6;
|
||||
var t6 = 0.7;
|
||||
var t7 = 1.0;
|
||||
|
||||
var curveLength = 44100;
|
||||
var curve = new Float32Array(curveLength);
|
||||
for (var i = 0; i < curveLength; ++i)
|
||||
curve[i] = Math.sin(Math.PI * i / curveLength);
|
||||
|
||||
param.setValueAtTime(0.2, t0);
|
||||
param.setValueAtTime(0.3, t1);
|
||||
param.setValueAtTime(0.4, t2);
|
||||
param.linearRampToValueAtTime(1, t3);
|
||||
param.linearRampToValueAtTime(0.15, t4);
|
||||
param.exponentialRampToValueAtTime(0.75, t5);
|
||||
param.exponentialRampToValueAtTime(0.05, t6);
|
||||
param.setValueCurveAtTime(curve, t6, t7 - t6);
|
||||
};
|
||||
|
||||
|
||||
()=>{
|
||||
var context: AudioContext;
|
||||
var filterNode: AudioNode;
|
||||
|
||||
var mediaElement = <HTMLMediaElement> document.getElementById('mediaElementID');
|
||||
var sourceNode = context.createMediaElementSource(mediaElement);
|
||||
sourceNode.connect(filterNode);
|
||||
};
|
||||
|
||||
()=>{
|
||||
|
||||
// Setup routing graph
|
||||
function setupRoutingGraph() {
|
||||
var context = new AudioContext();
|
||||
|
||||
var compressor = context.createDynamicsCompressor();
|
||||
|
||||
// Send1 effect
|
||||
var reverb = context.createConvolver();
|
||||
// Convolver impulse response may be set here or later
|
||||
|
||||
// Send2 effect
|
||||
var delay = context.createDelay();
|
||||
|
||||
// Connect final compressor to final destination
|
||||
compressor.connect(context.destination);
|
||||
|
||||
// Connect sends 1 & 2 through effects to main mixer
|
||||
var s1 = context.createGain();
|
||||
reverb.connect(s1);
|
||||
s1.connect(compressor);
|
||||
|
||||
var s2 = context.createGain();
|
||||
delay.connect(s2);
|
||||
s2.connect(compressor);
|
||||
|
||||
// Create a couple of sources
|
||||
var source1 = context.createBufferSource();
|
||||
var source2 = context.createBufferSource();
|
||||
source1.buffer = manTalkingBuffer;
|
||||
source2.buffer = footstepsBuffer;
|
||||
|
||||
// Connect source1
|
||||
var g1_1 = context.createGain();
|
||||
var g2_1 = context.createGain();
|
||||
var g3_1 = context.createGain();
|
||||
source1.connect(g1_1);
|
||||
source1.connect(g2_1);
|
||||
source1.connect(g3_1);
|
||||
g1_1.connect(compressor);
|
||||
g2_1.connect(reverb);
|
||||
g3_1.connect(delay);
|
||||
|
||||
// Connect source2
|
||||
var g1_2 = context.createGain();
|
||||
var g2_2 = context.createGain();
|
||||
var g3_2 = context.createGain();
|
||||
source2.connect(g1_2);
|
||||
source2.connect(g2_2);
|
||||
source2.connect(g3_2);
|
||||
g1_2.connect(compressor);
|
||||
g2_2.connect(reverb);
|
||||
g3_2.connect(delay);
|
||||
|
||||
// We now have explicit control over all the volumes g1_1, g2_1, ..., s1, s2
|
||||
g2_1.gain.value = 0.2; // For example, set source1 reverb gain
|
||||
|
||||
// Because g2_1.gain is an "AudioParam",
|
||||
// an automation curve could also be attached to it.
|
||||
// A "mixing board" UI could be created in canvas or WebGL controlling these gains.
|
||||
}
|
||||
};
|
||||
|
||||
()=>{
|
||||
var context: AudioContext;
|
||||
var compressor: DynamicsCompressorNode;
|
||||
var gainNode1: GainNode;
|
||||
var streamingAudioSource: MediaElementAudioSourceNode;
|
||||
|
||||
// Initial setup of the "long-lived" part of the routing graph
|
||||
function setupAudioContext() {
|
||||
context = new AudioContext();
|
||||
|
||||
compressor = context.createDynamicsCompressor();
|
||||
gainNode1 = context.createGain();
|
||||
|
||||
// Create a streaming audio source.
|
||||
var audioElement = <HTMLAudioElement> document.getElementById('audioTagID');
|
||||
streamingAudioSource = context.createMediaElementSource(audioElement);
|
||||
streamingAudioSource.connect(gainNode1);
|
||||
|
||||
gainNode1.connect(compressor);
|
||||
compressor.connect(context.destination);
|
||||
}
|
||||
|
||||
// Later in response to some user action (typically mouse or key event)
|
||||
// a one-shot sound can be played.
|
||||
function playSound() {
|
||||
var oneShotSound = context.createBufferSource();
|
||||
oneShotSound.buffer = dogBarkingBuffer;
|
||||
|
||||
// Create a filter, panner, and gain node.
|
||||
var lowpass = context.createBiquadFilter();
|
||||
var panner = context.createPanner();
|
||||
var gainNode2 = context.createGain();
|
||||
|
||||
// Make connections
|
||||
oneShotSound.connect(lowpass);
|
||||
lowpass.connect(panner);
|
||||
panner.connect(gainNode2);
|
||||
gainNode2.connect(compressor);
|
||||
|
||||
// Play 0.75 seconds from now (to play immediately pass in 0)
|
||||
oneShotSound.start(context.currentTime + 0.75);
|
||||
}
|
||||
};
|
||||
|
||||
Vendored
+1015
-136
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user