Merge remote-tracking branch 'remotes/parent/master'

This commit is contained in:
Natan Vivo
2013-05-10 21:29:57 -03:00
39 changed files with 2899 additions and 1448 deletions
+22
View File
@@ -0,0 +1,22 @@
# Auto detect text files and perform LF normalization
* text=none
# Custom for Visual Studio
*.cs diff=csharp
*.sln merge=union
*.csproj merge=union
*.vbproj merge=union
*.fsproj merge=union
*.dbproj merge=union
# Standard to msysgit
*.doc diff=astextplain
*.DOC diff=astextplain
*.docx diff=astextplain
*.DOCX diff=astextplain
*.dot diff=astextplain
*.DOT diff=astextplain
*.pdf diff=astextplain
*.PDF diff=astextplain
*.rtf diff=astextplain
*.RTF diff=astextplain
+43
View File
@@ -0,0 +1,43 @@
// Type definitions for FPSmeter v0.3.0
// Project: http://darsa.in/fpsmeter/
// Definitions by: Aaron Lampros <http://github.com/alampros/>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
interface FPSMeterOptions {
interval?: number; // Update interval in milliseconds.
smoothing?: number; // Spike smoothing strength. 1 means no smoothing.
show?: string; // Whether to show 'fps', or 'ms' = frame duration in milliseconds.
toggleOn?: string; // Toggle between show 'fps' and 'ms' on this event.
decimals?: number; // Number of decimals in FPS number. 1 = 59.9, 2 = 59.94, ...
maxFps?: number; // Max expected FPS value.
threshold?: number; // Minimal tick reporting interval in milliseconds.
position?: string; // Meter position.
zIndex?: number; // Meter Z index.
left?: string; // Meter left offset.
top?: string; // Meter top offset.
right?: string; // Meter right offset.
bottom?: string; // Meter bottom offset.
margin?: string; // Meter margin. Helps with centering the counter when left: 50%;
theme?: string; // Meter theme. Build in: 'dark', 'light', 'transparent', 'colorful'.
heat?: number; // Allow themes to use coloring by FPS heat. 0 FPS = red, maxFps = green.
graph?: number; // Whether to show history graph.
history?: number; // How many history states to show in a graph.
}
declare class FPSMeter {
constructor(anchor?: HTMLElement, options?: FPSMeterOptions);
public tick(): void;
public tickStart(): void;
public pause(): FPSMeter;
public resume(): FPSMeter;
public set(name: string, value: any): FPSMeter;
public showDuration(): FPSMeter;
public showFps(): FPSMeter;
public toggle(): FPSMeter;
public hide(): FPSMeter;
public show(): FPSMeter;
public destroy() : void;
}
+4
View File
@@ -54,8 +54,10 @@ List of Definitions
* [File API: Directories and System](http://www.w3.org/TR/file-system-api/) (by [Kon](http://phyzkit.net/))
* [File API: Writer](http://www.w3.org/TR/file-writer-api/) (by [Kon](http://phyzkit.net/))
* [Finite State Machine](https://github.com/jakesgordon/javascript-state-machine) (by [Boris Yankov](https://github.com/borisyankov))
* [Firebase](https://www.firebase.com/docs/javascript/firebase) (by [Vincent Bortone](https://github.com/vbortone))
* [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))
* [FPSMeter](http://darsa.in/fpsmeter/) (by [Aaron Lampros](https://github.com/alampros))
* [Gamepad](http://www.w3.org/TR/gamepad/) (by [Kon](http://phyzkit.net/))
* [glDatePicker](http://glad.github.com/glDatePicker/) (by [Dniel Tar](https://github.com/qcz))
* [GreenSock Animation Platform (GSAP)](http://www.greensock.com/get-started-js/) (by [Robert S.](https://github.com/codeBelt))
@@ -79,6 +81,7 @@ List of Definitions
* [jQuery.BBQ](http://benalman.com/projects/jquery-bbq-plugin/) (by [Adam R. Smith](https://github.com/sunetos))
* [jQuery.contextMenu](http://medialize.github.com/jQuery-contextMenu/) (by [Natan Vivo](https://github.com/nvivo/))
* [jQuery.clientSideLogging](https://github.com/remybach/jQuery.clientSideLogging/) (by [Diullei Gomes](https://github.com/diullei/))
* [jQuery.Colorbox](http://www.jacklmoore.com/colorbox/) (by [Gidon Junge](https://github.com/gjunge))
* [jQuery.Cookie](https://github.com/carhartl/jquery-cookie) (by [Roy Goode](https://github.com/RoyGoode))
* [jQuery.Cycle](http://jquery.malsup.com/cycle/) (by [Franois Guillot](http://fguillot.developpez.com/))
* [jQuery.dynatree](http://code.google.com/p/dynatree/) (by [Franois de Campredon](https://github.com/fdecampredon))
@@ -86,6 +89,7 @@ List of Definitions
* [jQuery.form](http://malsup.com/jquery/form/) (by [Franois Guillot](http://fguillot.developpez.com/))
* [jQuery.Globalize](https://github.com/jquery/globalize) (by [Boris Yankov](https://github.com/borisyankov))
* [jQuery.jNotify](http://jnotify.codeplex.com) (by [James Curran](https://github.com/jamescurran/))
* [jQuery.noty](http://needim.github.io/noty/) (by [Aaron King](https://github.com/kingdango/))
* [jQuery.scrollTo](https://github.com/flesler/jquery.scrollTo) (by [Neil Stalker](https://github.com/nestalk/))
* [jQuery.simplePagination](https://github.com/flaviusmatis/simplePagination.js) (by [Natan Vivo](https://github.com/nvivo/))
* [jQuery.timeago](http://timeago.yarp.com/) (by [Franois Guillot](http://fguillot.developpez.com/))
+1 -1
View File
@@ -11,7 +11,7 @@ declare var angular: ng.IAngularStatic;
///////////////////////////////////////////////////////////////////////////////
// ng module (angular.js)
///////////////////////////////////////////////////////////////////////////////
module ng {
declare module ng {
// All service providers extend this interface
interface IServiceProvider {
+157 -2
View File
@@ -1,4 +1,5 @@
/// <reference path="backbone.d.ts" />
/// <reference path="../jquery/jquery.d.ts" />
declare var _, $;
@@ -82,7 +83,6 @@ class Employee extends Backbone.Model {
}
class EmployeeCollection extends Backbone.Collection {
url: string = "../api/employees";
findByName(key) { }
}
function test_collection() {
@@ -111,4 +111,159 @@ function test_collection() {
//////////
Backbone.history.start();
Backbone.history.start();
module v1Changes {
module events {
function test_once() {
var model = new Employee;
model.once('invalid', () => { }, this);
model.once('invalid', () => { });
}
function test_listenTo() {
var model = new Employee;
var view = new Backbone.View;
view.listenTo(model, 'invalid', () => { });
}
function test_listenToOnce() {
var model = new Employee;
var view = new Backbone.View;
view.listenToOnce(model, 'invalid', () => { });
}
function test_stopListening() {
var model = new Employee;
var view = new Backbone.View;
view.stopListening(model, 'invalid', () => { });
view.stopListening(model, 'invalid');
view.stopListening(model);
}
}
module modelandcollection {
function test_url() {
Employee.prototype.url = () => '/employees';
EmployeeCollection.prototype.url = () => '/employees';
}
function test_parse() {
var model = new Employee();
model.parse('{}', {});
var collection = new EmployeeCollection;
collection.parse('{}', {});
}
function test_toJSON() {
var model = new Employee();
model.toJSON({});
var collection = new EmployeeCollection;
collection.toJSON({});
}
function test_sync() {
var model = new Employee();
model.sync();
var collection = new EmployeeCollection;
collection.sync();
}
}
module model {
function test_validationError() {
var model = new Employee;
if (model.validationError) {
console.log('has validation errors');
}
}
function test_fetch() {
var model = new Employee({ id: 1 });
model.fetch({
success: () => { },
error: () => { }
});
}
function test_set() {
var model = new Employee;
model.set({ name: 'JoeDoe', age: 21 }, { validate: false });
model.set('name', 'JoeDoes', { validate: false });
}
function test_destroy() {
var model = new Employee;
model.destroy({
wait: true,
success: (m?, response?, options?) => { },
error: (m?, jqxhr?: JQueryXHR, options?) => { }
});
model.destroy({
success: (m?, response?, options?) => { },
error: (m?, jqxhr?: JQueryXHR) => { }
});
model.destroy({
success: () => { },
error: (m?, jqxhr?: JQueryXHR) => { }
});
}
function test_save() {
var model = new Employee;
model.save({
name: 'Joe Doe',
age: 21
},
{
wait: true,
validate: false,
success: (m?, response?, options?) => { },
error: (m?, jqxhr?: JQueryXHR, options?) => { }
});
model.save({
name: 'Joe Doe',
age: 21
},
{
success: () => { },
error: (m?, jqxhr?: JQueryXHR) => { }
});
}
function test_validate() {
var model = new Employee;
model.validate({ name: 'JoeDoe', age: 21 }, { validateAge: false })
}
}
module collection {
function test_fetch() {
var collection = new EmployeeCollection;
collection.fetch({ reset: true });
}
function test_create() {
var collection = new EmployeeCollection;
var model = new Employee;
collection.create(model, {
validate: false
});
}
}
module router {
function test_navigate() {
var router = new Backbone.Router;
router.navigate('/employees', { trigger: true });
router.navigate('/employees', true);
}
}
}
+71 -23
View File
@@ -12,10 +12,6 @@ declare module Backbone {
at: number;
}
export interface CreateOptions extends Silenceable {
wait: bool;
}
export interface HistoryOptions extends Silenceable {
pushState?: bool;
root?: string;
@@ -33,27 +29,69 @@ declare module Backbone {
silent?: bool;
}
interface Validable {
validate?: bool;
}
interface Waitable {
wait?: bool;
}
interface Parseable {
parse?: any;
}
export interface PersistenceOptions {
url?: string;
beforeSend?: (jqxhr: JQueryXHR) => void;
success?: (modelOrCollection?: any, response?: any, options?: any) => void;
error?: (modelOrCollection?: any, jqxhr?: JQueryXHR, options?: any) => void;
}
export interface ModelSetOptions extends Silenceable extends Validable {
}
export interface ModelFetchOptions extends PersistenceOptions extends ModelSetOptions extends Parseable {
}
export interface ModelSaveOptions extends Silenceable extends Waitable extends Validable extends Parseable extends PersistenceOptions {
patch?: bool;
}
export interface ModelDestroyOptions extends Waitable extends PersistenceOptions {
}
export interface CollectionFetchOptions extends PersistenceOptions extends Parseable {
reset?: bool;
}
interface on { (eventName: string, callback: (...args: any[]) => void, context?: any): any; }
interface off { (eventName?: string, callback?: (...args: any[]) => void, context?: any): any; }
interface trigger { (eventName: string, ...args: any[]): any; }
interface bind { (eventName: string, callback: (...args: any[]) => void, context?: any): any; }
interface unbind { (eventName?: string, callback?: (...args: any[]) => void, context?: any): any; }
declare class Events {
on(eventName: string, callback: (...args:any[]) => void, context?: any): any;
off(eventName?: string, callback?: (...args:any[]) => void, context?: any): any;
trigger(eventName: string, ...args: any[]): any;
bind(eventName: string, callback: (...args:any[]) => void, context?: any): any;
unbind(eventName?: string, callback?: (...args:any[]) => void, context?: any): any;
once(events: string, callback: (...args: any[]) => void , context?: any): any;
listenTo(object: any, events: string, callback: (...args: any[]) => void ): any;
listenToOnce(object: any, events: string, callback: (...args: any[]) => void ): any;
stopListening(object?: any, events?: string, callback?: (...args: any[]) => void ): any;
}
export class ModelBase extends Events {
fetch(options?: JQueryAjaxSettings);
url: any;
parse(response);
toJSON(): any;
parse(response, options?: any);
toJSON(options?: any): any;
sync(...arg: any[]): JQueryXHR;
}
export class Model extends ModelBase {
static extend(properties: any, classProperties?: any): any; // do not use, prefer TypeScript's extend functionality
@@ -63,31 +101,34 @@ declare module Backbone {
cid: string;
id: any;
idAttribute: string;
urlRoot() : string;
validationError: any;
urlRoot(): string;
constructor (attributes?: any, options?: any);
initialize(attributes?: any);
fetch(options?: ModelFetchOptions): JQueryXHR;
get(attributeName: string): any;
set(attributeName: string, value: any, options?: Silenceable);
set(obj: any, options?: Silenceable);
set(attributeName: string, value: any, options?: ModelSetOptions);
set(obj: any, options?: ModelSetOptions);
change();
changedAttributes(attributes?: any): any[];
clear(options?: Silenceable);
clone(): Model;
defaults(): any;
destroy(options?: JQueryAjaxSettings);
destroy(options?: ModelDestroyOptions);
escape(attribute: string);
has(attribute: string): bool;
hasChanged(attribute?: string): bool;
isNew(): bool;
isValid(): string;
isValid(): bool;
previous(attribute: string): any;
previousAttributes(): any[];
save(attributes?: any, options?: JQueryAjaxSettings);
save(attributes?: any, options?: ModelSaveOptions);
unset(attribute: string, options?: Silenceable);
validate(attributes: any): any;
validate(attributes: any, options?: any): any;
}
export class Collection extends ModelBase {
@@ -101,6 +142,8 @@ declare module Backbone {
constructor (models?: any, options?: any);
fetch(options?: CollectionFetchOptions): JQueryXHR;
comparator(element: Model): number;
comparator(element: Model): string;
comparator(compare: Model, to?: Model): number;
@@ -109,7 +152,7 @@ declare module Backbone {
add(models: Model[], options?: AddOptions);
at(index: number): Model;
get(id: any): Model;
create(attributes: any, options?: CreateOptions): Model;
create(attributes: any, options?: ModelSaveOptions): Model;
pluck(attribute: string): any[];
push(model: Model, options?: AddOptions);
pop(options?: Silenceable);
@@ -124,6 +167,7 @@ declare module Backbone {
all(iterator: (element: Model, index: number) => bool, context?: any): bool;
any(iterator: (element: Model, index: number) => bool, context?: any): bool;
collect(iterator: (element: Model, index: number, context?: any) => any[], context?: any): any[];
chain(): any;
compact(): Model[];
contains(value: any): bool;
countBy(iterator: (element: Model, index: number) => any): any[];
@@ -189,6 +233,7 @@ declare module Backbone {
initialize (options?: RouterOptions);
route(route: string, name: string, callback?: (...parameter: any[]) => void);
navigate(fragment: string, options?: NavigateOptions);
navigate(fragment: string, trigger?: bool);
}
export var history: History;
@@ -204,7 +249,7 @@ declare module Backbone {
export interface ViewOptions {
model?: Backbone.Model;
collection?: Backbone.Collection;
el?: Element;
el?: any;
id?: string;
className?: string;
tagName?: string;
@@ -217,20 +262,23 @@ declare module Backbone {
constructor (options?: ViewOptions);
$(selector: string): any;
$(selector: string): JQuery;
model: Model;
collection: Collection;
make(tagName: string, attrs?, opts?): View;
setElement(element: HTMLElement, delegate?: bool);
id: string;
className: string;
tagName: string;
events: any;
el: HTMLElement;
$el;
el: any;
$el: JQuery;
setElement(element);
attributes;
$(selector);
render();
remove();
$(selector): JQuery;
render(): View;
remove(): View;
make(tagName, attributes?, content?);
//delegateEvents: any;
delegateEvents(events?: any): any;
+68
View File
@@ -0,0 +1,68 @@
/// <reference path="../chai/chai.d.ts" />
/// <reference path="chai-jquery.d.ts" />
declare var $;
var expect = chai.expect;
function test_attr() {
expect($('#foo')).to.have.attr('id');
expect($('#foo')).to.have.attr('class', 'container');
}
function test_css() {
expect($('#foo')).to.have.css('color');
expect($('#foo')).to.have.css('font-family', 'serif');
}
function test_data() {
expect($('#foo')).to.have.data('toggle');
expect($('#foo')).to.have.css('toggle', 'true');
}
function test_class() {
expect($('#foo')).to.have.class('container');
}
function test_id() {
expect($('#foo')).to.have.id('foo');
}
function test_html() {
expect($('#foo')).to.have.html('<div>bar</div>');
}
function test_text() {
expect($('#foo')).to.have.text('bar');
}
function test_value() {
expect($('#foo')).to.have.value('bar');
}
function test_visible() {
expect($('#foo')).to.be.visible;
}
function test_hidden() {
expect($('#foo')).to.be.hidden;
}
function test_selected() {
expect($('#foo')).to.be.selected;
}
function test_checked() {
expect($('#foo')).to.be.checked;
}
function test_disabled() {
expect($('#foo')).to.be.disabled;
}
function test_be_selector() {
expect($('#foo')).to.be(':empty');
}
function test_have_selector() {
expect($('#foo')).to.have('div');
}
+37
View File
@@ -0,0 +1,37 @@
// Type definitions for chai-jquery 1.1.1
// Project: https://github.com/chaijs/chai-jquery
// Definitions by: Kazi Manzur Rashid <https://github.com/kazimanzurrashid/>
// DefinitelyTyped: https://github.com/borisyankov/DefinitelyTyped
/// <reference path="../chai/chai.d.ts" />
declare module chai {
interface NameValueRegexMatcher {
match(value: RegExp): bool;
}
interface NameValueMatcher {
(name: string, value?: string): bool;
}
interface Have {
attr: NameValueMatcher;
css: NameValueMatcher;
data: NameValueMatcher;
class(className: string): bool;
id(id: string): bool;
html(html: string): bool;
text(text: string): bool;
value(text: string): bool;
(selector: string): bool;
}
interface Be {
visible: bool;
hidden: bool;
selected: bool;
checked: bool;
disabled: bool;
(selector: string): bool;
}
}
+90
View File
@@ -0,0 +1,90 @@
/// <reference path="chai.d.ts" />
var expect = chai.expect;
function test_be() {
expect(true).to.be.ok;
expect(true).to.be.true;
expect(false).to.be.false;
expect(null).to.be.null;
expect(undefined).to.be.undefined;
expect([]).to.be.empty;
expect([]).to.be.arguments;
expect({}).to.be.an('object');
expect({}).to.be.an.instanceof(Object);
expect(5).to.be.at.least(5);
expect(5).to.be.at.gte(5);
expect(5).to.be.at.most(5);
expect(5).to.be.at.lte(5);
expect('').to.be.a('string');
expect(5).to.be.within(1, 6);
expect(5.001).to.be.closeTo(5, 0.5);
}
function test_not() {
expect(5).to.not.be.a('string');
}
function test_deep() {
expect(5).to.deep.equal(5);
expect({ foo: 'bar' }).to.deep.property('foo', 'bar');
}
function test_have() {
expect({ foo: 'bar' }).to.have.property('foo', 'bar');
expect([]).to.have.length(5);
expect({ foo: 'bar' }).to.have.ownProperty('foo');
expect('foo-bar').to.have.string('bar');
expect({ foo: 'bar', baz: 'qux' }).to.have.keys('foo', 'baz');
}
function test_exist() {
var obj = { foo: 'bar' };
expect(obj.foo).to.exist;
}
function test_equal() {
expect(5).to.equal(5);
}
function test_include() {
expect('foo-bar').to.include('o-b');
expect([1,2,3]).to.include(2);
expect({ foo: 'bar', baz: 'qux' }).to.include.keys('foo', 'baz');
expect('foo-bar').to.contain('o-b');
expect([1,2,3]).to.contain(2);
expect({ foo: 'bar', baz: 'qux' }).to.contain.keys('foo', 'baz');
}
function test_throw() {
var foo = {
bar: () => { }
};
expect(foo.bar).to.throw(new Error);
expect(foo.bar).to.throw('An error');
expect(foo.bar).to.throw(/error/);
}
function test_eql() {
var foo = {}
expect(foo).to.eql({});
expect(foo).to.eqls({});
}
function test_match() {
expect('foo-bar').to.match(/foo/);
}
function test_respondTo() {
var foo = {
bar: () => { }
};
expect(foo).to.respondTo('bar');
}
function test_satisfy() {
expect(1).to.satisfy((n) => n > 0);
}
+6 -1
View File
@@ -1,4 +1,9 @@
declare module chai {
// Type definitions for chai 1.5.0
// Project: http://chaijs.com/
// Definitions by: Kazi Manzur Rashid <https://github.com/kazimanzurrashid/>
// DefinitelyTyped: https://github.com/borisyankov/DefinitelyTyped
declare module chai {
interface Equality {
(expected: any, message?: string): bool;
}
Vendored
+100
View File
@@ -989,6 +989,7 @@ declare module D3 {
interface Layout {
stack(): StackLayout;
pie(): PieLayout;
force(): ForceLayout;
}
interface StackLayout {
@@ -1357,6 +1358,105 @@ declare module D3 {
*/
irwinHall(count: number): () => number;
}
// force layout definitions
export interface twoDGraphPoint {
id: number;
index: number;
name: string;
px: number;
py: number;
size: number;
weight: number;
x: number;
y: number;
}
export interface graphNode extends twoDGraphPoint {
fixed: bool;
children: graphNode[];
_children: graphNode[];
}
export interface graphLink {
source: graphNode;
target: graphNode;
}
export interface ForceLayout {
(): ForceLayout;
size: {
(): number;
(mysize: number[]): ForceLayout;
(accessor: (d: any, index: number) => {}): ForceLayout;
};
linkDistance: {
(): number;
(number): ForceLayout;
(accessor: (d: any, index: number) => number): ForceLayout;
};
linkStrength:
{
(): number;
(number): ForceLayout;
(accessor: (d: any, index: number) => number): ForceLayout;
};
friction:
{
(): number;
(number): ForceLayout;
(accessor: (d: any, index: number) => number): ForceLayout;
};
alpha: {
(): number;
(number): ForceLayout;
(accessor: (d: any, index: number) => number): ForceLayout;
};
charge: {
(): number;
(number): ForceLayout;
(accessor: (d: any, index: number) => number): ForceLayout;
};
theta: {
(): number;
(number): ForceLayout;
(accessor: (d: any, index: number) => number): ForceLayout;
};
gravity: {
(): number;
(number): ForceLayout;
(accessor: (d: any, index: number) => number): ForceLayout;
};
links: {
(): graphLink[];
(arLinks: graphLink[]): ForceLayout;
};
nodes:
{
(): graphNode[];
(arNodes: graphNode[]): ForceLayout;
};
start(): ForceLayout;
resume(): ForceLayout;
stop(): ForceLayout;
tick(): ForceLayout;
on(type: string, listener: () => void ): ForceLayout;
drag(): ForceLayout;
}
}
declare var d3: D3.Base;
+1
View File
@@ -526,6 +526,7 @@ declare module fabric {
getContext(): CanvasRenderingContext2D;
getElement(): HTMLCanvasElement;
getHeight(): number;
getObjects(): IObject[];
getWidth(): number;
insertAt(object: IObject, index: number, nonSplicing: bool): ICanvas;
isEmpty(): bool;
+74
View File
@@ -0,0 +1,74 @@
/// <reference path="firebase.d.ts" />
var AUTH_TOKEN: string = "12345";
var dataRef:Firebase = new Firebase("https://SampleChat.firebaseio-demo.com/");
//Log me in
dataRef.auth(AUTH_TOKEN, function(error, result) {
if(error) {
console.log("Login Failed!", error);
} else {
console.log('Authenticated successfully with payload:', result.auth);
console.log('Auth expires at:', new Date(result.expires * 1000));
}
});
//Time to log out!
dataRef.unauth();
var usersRef:Firebase = new Firebase('https://SampleChat.firebaseIO-demo.com/users/');
var fredRef:Firebase = usersRef.child('fred');
var fredFirstNameRef:Firebase = fredRef.child('name/first');
var x:string = fredFirstNameRef.toString();
// x is now 'https://SampleChat.firebaseIO-demo.com/users/fred/name/first'.
var usersRef2:Firebase = new Firebase('https://SampleChat.firebaseIO-demo.com/users/');
var sampleChatRef:Firebase = usersRef2.parent();
var x2:string = sampleChatRef.toString();
// x is now 'https://SampleChat.firebaseIO-demo.com'.
var y:Firebase = sampleChatRef.parent();
// y is now null, since sampleChatRef refers to the root of the Firebase.
var fredRef2:Firebase = new Firebase('https://SampleChat.firebaseIO-demo.com/users/fred');
var sampleChatRef2 :Firebase= fredRef2.root();
var x3:string = sampleChatRef2.toString();
// x is now 'https://SampleChat.firebaseIO-demo.com'.
var fredRef3:Firebase = new Firebase('https://SampleChat.firebaseIO-demo.com/users/fred');
var x4:string = fredRef3.name();
// x is now 'fred'.
// Increment Fred's rank by 1.
var fredRankRef:Firebase = new Firebase('https://SampleChat.firebaseIO-demo.com/users/fred/rank');
fredRankRef.transaction(function(currentRank: number) {
return currentRank+1;
});
// Try to create a user for wilma, but only if the user id 'wilma' isn't already taken.
var wilmaRef: Firebase = new Firebase('https://SampleChat.firebaseIO-demo.com/users/wilma');
wilmaRef.transaction(function(currentData) {
if (currentData === null) {
return {name: {first: 'Wilma', last: 'Flintstone'} };
} else {
console.log('User wilma already exists.');
return; // Abort the transaction.
}
}, function(error: any, committed: bool, snapshot: IFirebaseDataSnapshot) {
if (error)
console.log('Transaction failed abnormally!', error);
else if (!committed)
console.log('We aborted the transaction (because wilma already exists).');
else
console.log('User wilma added!');
console.log('Wilma\'s data: ', snapshot.val());
});
var messageListRef: Firebase = new Firebase('https://SampleChat.firebaseIO-demo.com/message_list');
var lastMessagesQuery:IFirebaseQuery = messageListRef.endAt().limit(500);
lastMessagesQuery.on('child_added', function(childSnapshot: IFirebaseDataSnapshot) { /* handle child add */ });
var messageListRef2:Firebase = new Firebase('https://SampleChat.firebaseIO-demo.com/message_list');
var firstMessagesQuery:IFirebaseQuery = messageListRef2.startAt().limit(500);
firstMessagesQuery.on('child_added', function(childSnapshot: IFirebaseDataSnapshot) { /* handle child add */ });
var usersRef3: Firebase = new Firebase('https://SampleChat.firebaseIO-demo.com/users');
var usersQuery: IFirebaseQuery = usersRef3.startAt(1000).limit(50);
usersQuery.on('child_added', function(userSnapshot: IFirebaseDataSnapshot) { /* handle user */ });
+74
View File
@@ -0,0 +1,74 @@
// Type definitions for Firebase API
// Project: https://www.firebase.com/docs/javascript/firebase/index.html
// Definitions by: Vincent Botone <https://github.com/vbortone/>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
interface IFirebaseAuthResult {
auth: any;
expires: number;
}
interface IFirebaseDataSnapshot {
val(): any;
child(): IFirebaseDataSnapshot;
forEach(childAction: (childSnapshot: IFirebaseDataSnapshot) => bool): bool;
hasChild(childPath: string): bool;
hasChildren(): bool;
name(): string;
numChildren(): number;
ref(): Firebase;
getPriority(): string;
getPriority(): number;
exportVal(): Object;
}
interface IFirebaseOnDisconnect {
set(value: any, onComplete?: (error: any) => void): void;
setWithPriority(value: any, priority: string, onComplete?: (error: any) => void): void;
setWithPriority(value: any, priority: number, onComplete?: (error: any) => void): void;
update(value: any, onComplete?: (error: any) => void): void;
remove(onComplete?: (error: any) => void): void;
cancel(onComplete?: (error: any) => void): void;
}
interface IFirebaseQuery {
on(eventType: string, callback: (dataSnapshot: IFirebaseDataSnapshot, prevChildName?: string) => void, cancelCallback?: ()=> void, context?: Object): (dataSnapshot: IFirebaseDataSnapshot, prevChildName?: string) => void;
off(eventType?: string, callback?: (dataSnapshot: IFirebaseDataSnapshot, prevChildName?: string) => void, context?: Object): void;
once(eventType: string, successCallback: (dataSnapshot: IFirebaseDataSnapshot) => void, failureCallback?: () => void, context?: Object): void;
limit(limit: number): IFirebaseQuery;
startAt(priority?: string, name?: string): IFirebaseQuery;
startAt(priority?: number, name?: string): IFirebaseQuery;
endAt(priority?: string, name?: string): IFirebaseQuery;
endAt(priority?: number, name?: string): IFirebaseQuery;
ref(): Firebase;
}
class Firebase implements IFirebaseQuery {
constructor(firebaseURL: string);
auth(authToken: string, onComplete?: (error: string, result: IFirebaseAuthResult) => void, onCancel?:(error: string) => void): void;
unauth(): void;
child(childPath: string): Firebase;
parent(): Firebase;
root(): Firebase;
name(): string;
toString(): string;
set(value: any, onComplete?: (error: any) => void): void;
update(value: any, onComplete?: (error: any) => void): void;
remove(onComplete?: (error: any) => void);
push(value: any, onComplete?: (error: any) => void): Firebase;
setWithPriority(value: any, priority: string, onComplete?: (error: any) => void): void;
setWithPriority(value: any, priority: number, onComplete?: (error: any) => void): void;
setPriority(priority: string, onComplete?: (error: any) => void): void;
setPriority(priority: number, onComplete?: (error: any) => void): void;
transaction(updateFunction: (currentData: any)=> any, onComplete?: (error: any, committed: bool, snapshot: IFirebaseDataSnapshot) => void, applyLocally?: bool): void;
onDisconnect(): IFirebaseOnDisconnect;
on(eventType: string, callback: (dataSnapshot: IFirebaseDataSnapshot, prevChildName?: string) => void, cancelCallback?: ()=> void, context?: Object): (dataSnapshot: IFirebaseDataSnapshot, prevChildName?: string) => void;
off(eventType?: string, callback?: (dataSnapshot: IFirebaseDataSnapshot, prevChildName?: string) => void, context?: Object): void;
once(eventType: string, successCallback: (dataSnapshot: IFirebaseDataSnapshot) => void, failureCallback?: () => void, context?: Object): void;
limit(limit: number): IFirebaseQuery;
startAt(priority?: string, name?: string): IFirebaseQuery;
startAt(priority?: number, name?: string): IFirebaseQuery;
endAt(priority?: string, name?: string): IFirebaseQuery;
endAt(priority?: number, name?: string): IFirebaseQuery;
ref(): Firebase;
}
+15 -1
View File
@@ -91,6 +91,8 @@ declare module google.maps {
mapMaker?: bool;
mapTypeControl?: bool;
mapTypeControlOptions?: MapTypeControlOptions;
navigationControl?: bool;
navigationControlOptions?: NavigationControlOptions;
mapTypeId?: MapTypeId;
maxZoom?: number;
minZoom?: number;
@@ -184,6 +186,18 @@ declare module google.maps {
TOP_RIGHT
}
export interface NavigationControlOptions {
position?: ControlPosition;
style?: NavigationControlStyle;
}
export enum NavigationControlStyle {
DEFAULT,
SMALL,
ANDROID,
ZOOM_PAN
}
/***** Overlays *****/
export class Marker extends MVCObject {
static MAX_ZINDEX: number;
@@ -321,7 +335,7 @@ declare module google.maps {
export interface PolylineOptions {
clickable?: bool;
draggable: bool;
draggable?: bool;
editable?: bool;
geodesic?: bool;
icons?: IconSequence[];
+10 -2
View File
@@ -31,7 +31,7 @@ declare module jasmine {
function any(aclass: any);
function createSpy(name: string): Spy;
function createSpyObj(baseName: string, methodNames: any[]): any;
function pp(value: any): string;
function getEnv(): Env;
interface Any {
@@ -145,6 +145,12 @@ declare module jasmine {
new (env: Env, actual, spec: Env, isNot?: bool);
env: Env;
actual: any;
spec: Env;
isNot?: bool;
message(): any;
toBe(expected): bool;
toNotBe(expected): bool;
toEqual(expected): bool;
@@ -232,6 +238,8 @@ declare module jasmine {
}
interface Spy {
(...params: any[]): any;
identity: string;
calls: any[];
mostRecentCall: { args: any[]; };
@@ -295,4 +303,4 @@ declare module jasmine {
}
export var HtmlReporter: any;
}
}
+30
View File
@@ -0,0 +1,30 @@
/// <reference path="../jquery/jquery.d.ts"/>
/// <reference path="jquery.colorbox.d.ts"/>
//Image gallery
var gallery : JQuery = $('a.gallery').colorbox({ rel: 'gal' });
// Ajax usage
var jQueryElement: JQuery = jQuery("a#login").colorbox();
// Programmatic use
var result1: any = jQuery.colorbox({ href: "thankyou.html" });
var result2: any = jQuery.colorbox({ html: "<h1>Welcome</h1>" });
var result3: any = $("a.gallery").colorbox({
rel: 'gal', title: function () {
var url = $(this).attr('href');
return '<a href="' + url + '" target="_blank">Open In New Window</a>';
}
});
// Helpers
jQuery.colorbox.close();
jQuery.colorbox.next();
jQuery.colorbox.prev();
var result4: JQuery = jQuery.colorbox.element();
jQuery.colorbox.remove();
jQuery.colorbox.resize();
jQuery.colorbox.resize({ height: 500, width: 300 });
+295
View File
@@ -0,0 +1,295 @@
/// <reference path="../jquery/jquery.d.ts" />
// Type definitions for jQuery.Colorbox 1.4.15
// Project: http://www.jacklmoore.com/colorbox/
// Definitions by: Gidon Junge <@gjunge>
// Definitions: https://github.com/borisyankov/DefinitelyTyped/
interface ColorboxResizeSettings {
height?: number;
innerHeight?: number;
width?: number;
innerWidth?: number;
}
interface ColorboxSettings {
/**
* The transition type. Can be set to "elastic", "fade", or "none".
*/
transition?: string;
/**
* Sets the speed of the fade and elastic transitions, in milliseconds.
*/
speed?: number;
/**
* This can be used as an alternative anchor URL or to associate a URL for non-anchor elements such as images or form buttons.
*/
href?: any;
/**
* This can be used as an anchor title alternative for Colorbox.
*/
title?: any;
/**
* This can be used as an anchor rel alternative for Colorbox.
*/
rel?: any;
/**
* If true, and if maxWidth, maxHeight, innerWidth, innerHeight, width, or height have been defined, Colorbox will scale photos to fit within the those values.
*/
scalePhotos?: bool;
/**
* If false, Colorbox will hide scrollbars for overflowing content.
*/
scrolling?: bool;
/**
* The overlay opacity level. Range: 0 to 1.
*/
opacity?: number;
/**
* If true, Colorbox will immediately open.
*/
open?: bool;
/**
* If true, focus will be returned when Colorbox exits to the element it was launched from.
*/
returnFocus?: bool;
/**
* If false, the loading graphic removal and onComplete event will be delayed until iframe's content has completely loaded.
*/
fastIframe?: bool;
/**
* Allows for preloading of 'Next' and 'Previous' content in a group, after the current content has finished loading. Set to false to disable.
*/
preloading?: bool;
/**
* If false, disables closing Colorbox by clicking on the background overlay.
*/
overlayClose?: bool;
/**
* If false, will disable closing colorbox on 'esc' key press.
*/
escKey?: bool;
/**
* If false, will disable the left and right arrow keys from navigating between the items in a group.
*/
arrowKey?: bool;
/**
* If false, will disable the ability to loop back to the beginning of the group when on the last element.
*/
loop?: bool;
/**
* For submitting GET or POST values through an ajax request. The data property will act exactly like jQuery's .load() data argument, as Colorbox uses .load() for ajax handling.
*/
data?: any;
/**
* Adds a given class to colorbox and the overlay.
*/
className?: any;
/**
* Sets the fadeOut speed, in milliseconds, when closing Colorbox.
*/
fadeOut?: number;
/**
* Text or HTML for the group counter while viewing a group. {current} and {total} are detected and replaced with actual numbers while Colorbox runs.
*/
current?: string;
/**
* Text or HTML for the previous button while viewing a group.
*/
previous?: string;
/**
* Text or HTML for the next button while viewing a group.
*/
next?: string;
/**
* Text or HTML for the close button. The 'esc' key will also close Colorbox.
*/
close?: string;
/**
* Error message given when ajax content for a given URL cannot be loaded.
*/
xhrError?: string;
/**
* Error message given when a link to an image fails to load.
*/
imgError?: string;
/**
* If true, specifies that content should be displayed in an iFrame.
*/
iframe?: bool;
/**
* If true, content from the current document can be displayed by passing the href property a jQuery selector, or jQuery object.
*/
inline?: bool;
/**
* For displaying a string of HTML or text: $.colorbox({html:"<p>Hello</p>"});
*/
html?: any;
/**
* If true, this setting forces Colorbox to display a link as a photo. Use this when automatic photo detection fails (such as using a url like 'photo.php' instead of 'photo.jpg')
*/
photo?: bool;
/**
* This property isn't actually used as Colorbox assumes all hrefs should be treated as either ajax or photos, unless one of the other content types were specified.
*/
ajax?: any;
/**
* Set a fixed total width. This includes borders and buttons. Example: "100%", "500px", or 500
*/
width?: any;
/**
* Set a fixed total height. This includes borders and buttons. Example: "100%", "500px", or 500
*/
height?: any;
/**
* This is an alternative to 'width' used to set a fixed inner width. This excludes borders and buttons. Example: "50%", "500px", or 500
*/
innerWidth?: any;
/**
* This is an alternative to 'height' used to set a fixed inner height. This excludes borders and buttons. Example: "50%", "500px", or 500
*/
innerHeight?: any;
/**
* Set the initial width, prior to any content being loaded.
*/
initialWidth?: number;
/**
* Set the initial height, prior to any content being loaded.
*/
initialHeight?: number;
/**
* Set a maximum width for loaded content. Example: "100%", 500, "500px"
*/
maxWidth?: any;
/**
* Set a maximum height for loaded content. Example: "100%", 500, "500px"
*/
maxHeight?: any;
/**
* If true, adds an automatic slideshow to a content group / gallery.
*/
slideshow?: bool;
/**
* Sets the speed of the slideshow, in milliseconds.
*/
slideshowSpeed?: number;
/**
* If true, the slideshow will automatically start to play.
*/
slideshowAuto?: bool;
/**
* Text for the slideshow start button.
*/
slideshowStart?: string;
/**
* Text for the slideshow stop button
*/
slideshowStop?: string;
/**
* If true, Colorbox will be displayed in a fixed position within the visitor's viewport. This is unlike the default absolute positioning relative to the document.
*/
fixed?: bool;
/**
* Accepts a pixel or percent value (50, "50px", "10%"). Controls Colorbox's vertical positioning instead of using the default position of being centered in the viewport.
*/
top?: any;
/**
* Accepts a pixel or percent value (50, "50px", "10%"). Controls Colorbox's vertical positioning instead of using the default position of being centered in the viewport.
*/
bottom?: any;
/**
* Accepts a pixel or percent value (50, "50px", "10%"). Controls Colorbox's horizontal positioning instead of using the default position of being centered in the viewport.
*/
left?: any;
/**
* Accepts a pixel or percent value (50, "50px", "10%"). Controls Colorbox's horizontal positioning instead of using the default position of being centered in the viewport.
*/
right?: any;
/**
* Repositions Colorbox if the window's resize event is fired.
*/
reposition?: bool;
/**
* If true, Colorbox will scale down the current photo to match the screen's pixel ratio
*/
retinaImage?: bool;
/**
* If true and the device has a high resolution display, Colorbox will replace the current photo's file extention with the retinaSuffix+extension
*/
retinaUrl?: bool;
/**
* If retinaUrl is true and the device has a high resolution display, the href value will have it's extention extended with this suffix. For example, the default value would change `my-photo.jpg` to `my-photo@2x.jpg`
*/
retinaSuffix?: string;
/**
* Callback that fires right before Colorbox begins to open.
*/
onOpen?: any;
/**
* Callback that fires right before attempting to load the target content.
*/
onLoad?: any;
/**
* Callback that fires right after loaded content is displayed.
*/
onComplete?: any;
/**
* Callback that fires at the start of the close process.
*/
onCleanup?: any;
/**
* Callback that fires once Colorbox is closed.
*/
onClosed?: any;
}
interface ColorboxStatic {
/**
* This method allows you to call Colorbox without having to assign it to an element.
*/
(settings: ColorboxSettings);
/**
* This method moves to the next item in a group and are the same as pressing the 'next' or 'previous' buttons.
*/
next(): void;
/**
* This method moves to the previous item in a group and are the same as pressing the 'next' or 'previous' buttons.
*/
prev(): void;
/**
* This method initiates the close sequence, which does not immediately complete. The lightbox will be completely closed only when the cbox_closed event / onClosed callback is fired.
*/
close(): void;
/**
* This method is used to fetch the current HTML element that Colorbox is associated with.
*/
element(): JQuery;
/**
* This allows Colorbox to be resized based on it's own auto-calculations, or to a specific size. This must be called manually after Colorbox's content has loaded.
*/
resize(): void;
/**
* This allows Colorbox to be resized based on it's own auto-calculations, or to a specific size. This must be called manually after Colorbox's content has loaded.
*/
resize(settings: ColorboxResizeSettings): void;
/**
* Removes all traces of Colorbox from the document.
*/
remove(): void;
}
interface Colorbox {
(): JQuery;
(settings: ColorboxSettings): JQuery;
}
interface JQueryStatic {
colorbox: ColorboxStatic;
}
interface JQuery {
colorbox: Colorbox;
}
+67
View File
@@ -0,0 +1,67 @@
// Typescript type definitions for jQuery.noty v2.0 by Nedim Carter <http://needim.github.io>
// Project: http://needim.github.io/noty/
// Definitions by: Aaron King <https://github.com/kingdango/>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
/// <reference path='../jquery/jquery.d.ts'/>
interface NotyOptions {
layout?: string;
theme?: string;
type?: string;
text?: string;
dismissQueue?: bool;
template?: string;
animation?: NotyAnimationOptions;
timeout?: number;
force?: bool;
modal?: bool;
closeWith?: Array;
callback?: NotyCallbackOptions;
buttons?: any;
}
interface NotyAnimationOptions {
open?: any;
close?: any;
easing?: string;
speed?: number;
}
interface NotyCallbackOptions {
onShow?: Function;
afterShow?: Function;
onClose?: Function;
afterClose?: Function;
}
interface NotyStatic {
(notyOptions: NotyOptions);
get(id: any);
close(id: any);
clearQueue();
closeAll();
setText(id: any, text: string);
setType(id: any, type: string);
}
interface JQueryStatic {
noty: NotyStatic;
}
declare var noty: {
(notyOptions: NotyOptions);
show();
close();
setText(text: string);
setType(type: string);
setTimeout(timeout: number);
closed: bool;
shown: bool;
}
+8
View File
@@ -2279,4 +2279,12 @@ function test_parseHTML() {
$( "<ol></ol>" )
.append( nodeNames.join( "" ) )
.appendTo( $log );
}
function test_EventIsNewable() {
var ev = new jQuery.Event('click');
}
function test_EventIsCallable() {
var ev = jQuery.Event('click');
}
+5 -2
View File
@@ -89,7 +89,7 @@ interface JQueryPromise {
state(): string;
pipe(doneFilter?: (x: any) => any, failFilter?: (x: any) => any, progressFilter?: (x: any) => any): JQueryPromise;
then(doneCallbacks: any, failCallbacks?: any, progressCallbacks?: any): JQueryPromise;
promise(target?): JQueryPromise;
promise(target?): JQueryPromise;
}
/*
@@ -282,7 +282,10 @@ interface JQueryStatic {
(fn?: (d: JQueryDeferred) => any): JQueryDeferred;
new(fn?: (d: JQueryDeferred) => any): JQueryDeferred;
};
Event(name:string, eventProperties?:any): JQueryEventObject;
Event: {
(name:string, eventProperties?:any): JQueryEventObject;
new(name:string, eventProperties?:any): JQueryEventObject;
};
/*********
INTERNALS
+953 -953
View File
File diff suppressed because it is too large Load Diff
+53
View File
@@ -0,0 +1,53 @@
/// <reference path="fixtures.d.ts" />
function test_path() {
fixtures.path = "/fixtures";
}
function test_containerId() {
fixtures.containerId = "fixtures";
}
function test_body() {
if (!fixtures.body()) {
console.log('body is empty');
}
}
function test_window() {
if (!fixtures.window) {
console.log('window is not set');
}
}
function test_set() {
fixtures.set('<div></div>');
}
function test_appendSet() {
fixtures.appendSet('<div></div>');
}
function test_preload() {
fixtures.preload('/dummy-fixtures.html');
}
function test_load() {
fixtures.load('/dummy-fixtures1.html', '/dummy-fixtures2.html');
}
function test_appendLoad() {
fixtures.appendLoad('/dummy-fixtures1.html', '/dummy-fixtures2.html');
}
function test_read() {
fixtures.read('/dummy-fixtures1.html', '/dummy-fixtures2.html');
}
function test_clearCache() {
fixtures.clearCache();
}
function test_clearCleanup() {
fixtures.cleanUp();
}
+5
View File
@@ -1,3 +1,8 @@
// Type definitions for js-fixtures 1.2.0
// Project: https://github.com/badunk/js-fixtures
// Definitions by: Kazi Manzur Rashid <https://github.com/kazimanzurrashid/>
// DefinitelyTyped: https://github.com/borisyankov/DefinitelyTyped
declare interface Fixtures {
path: string;
containerId: string;
+4 -1
View File
@@ -12,7 +12,8 @@ interface jsPlumb {
bind(event: string, callback: (e) => void ): void;
unbind(event?: string): void;
ready(callback: () => void): void;
importDefaults(defaults: Defaults): void;//
importDefaults(defaults: Defaults): void;
Defaults: Defaults;
restoreDefaults(): void;
addClass(el: any, clazz: string): void;
addEndpoint(ep: string): any;
@@ -27,10 +28,12 @@ interface jsPlumb {
detachAllConnections(el: string): void;
removeAllEndpoints(el: any): void;
select(params: SelectParams): Connections;
getConnections(options?: any, flat?: any): any[];
}
interface Defaults {
Endpoint?: any[];
PaintStyle?: PaintStyle;
HoverPaintStyle?: PaintStyle;
ConnectionsDetachable?: bool;
ReattachConnections?: bool;
+2
View File
@@ -33,6 +33,8 @@ interface KnockoutMapping {
fromJS(jsObject: any, targetOrOptions: any): any;
fromJS(jsObject: any, inputOptions: any, target: any): any;
fromJSON(jsonString: string): any;
fromJSON(jsonString: string, targetOrOptions: any): any;
fromJSON(jsonString: string, inputOptions: any, target: any): any;
toJS(rootObject: any, options?: KnockoutMappingOptions): any;
toJSON(rootObject: any, options?: KnockoutMappingOptions): any;
defaultOptions(): KnockoutMappingOptions;
+52
View File
@@ -0,0 +1,52 @@
/// <reference path="mocha.d.ts" />
function test_describe() {
describe('something', () => { });
describe.only('something', () => { });
describe.skip('something', () => { });
describe('something', function() {
this.timeout(2000);
});
}
function test_it() {
it('does something', () => { });
it('does something', (done) => { done(); });
it.only('does something', () => { });
it.skip('does something', () => { });
it('does something', function () {
this.timeout(2000);
});
}
function test_before() {
before(() => { });
before((done) => { done(); });
}
function test_after() {
after(() => { });
after((done) => { done(); });
}
function test_beforeEach() {
beforeEach(() => { });
beforeEach((done) => { done(); });
}
function test_afterEach() {
afterEach(() => { });
afterEach((done) => { done(); });
}
+5
View File
@@ -1,3 +1,8 @@
// Type definitions for mocha 1.9.0
// Project: http://visionmedia.github.io/mocha/
// Definitions by: Kazi Manzur Rashid <https://github.com/kazimanzurrashid/>
// DefinitelyTyped: https://github.com/borisyankov/DefinitelyTyped
declare var describe : {
(description: string, spec: () => void): void;
only(description: string, spec: () => void): void;
+35
View File
@@ -17,6 +17,35 @@ interface VideoBool {
webm: bool;
}
interface InputBool {
autocomplete: bool;
autofocus: bool;
list: bool;
placeholder: bool;
max: bool;
min: bool;
multiple: bool;
pattern: bool;
required: bool;
step: bool;
}
interface InputTypesBool {
search: bool;
tel: bool;
url: bool;
email: bool;
datetime: bool;
date: bool;
month: bool;
week: bool;
time: bool;
datetimelocal: bool;
number: bool;
range: bool;
color: bool;
}
interface ModernizrStatic {
fontface: bool;
backgroundsize: bool;
@@ -46,6 +75,8 @@ interface ModernizrStatic {
audio: AudioBool;
video: VideoBool;
indexeddb: bool;
input: InputBool;
inputtypes: InputTypesBool;
localstorage: bool;
postmessage: bool;
sessionstorage: bool;
@@ -60,6 +91,10 @@ interface ModernizrStatic {
touch: bool;
webgl: bool;
load(resources: Array);
load(resourceObject: any);
load(resourceString: string);
prefixed(): bool;
prefixed(property: string): bool;
prefixed(property: string, obj: any, element?: any): bool;
+1 -1
View File
@@ -33,7 +33,7 @@ declare function clearInterval(intervalId: any);
declare var require: {
(id: string): any;
resolve(): string;
resolve(id:string): string;
cache: any;
extensions: any;
}
+23 -1
View File
@@ -80,4 +80,26 @@ transport.sendMail(message, function (error) {
return;
}
console.log('Message sent successfully!');
});
});
// From the SMTP section of https://npmjs.org/package/nodemailer README
var smptTransport1: Transport = nodemailer.createTransport("SMTP", {
service: "Gmail", // sets automatically host, port and connection security settings
auth: {
user: "gmail.user@gmail.com",
pass: "userpass"
}
});
var smtpTransport2: Transport = nodemailer.createTransport("SMTP", {
host: "smtp.gmail.com", // hostname
secureConnection: true, // use SSL
port: 465, // port for secure SMTP
auth: {
user: "gmail.user@gmail.com",
pass: "userpass"
}
});
+23 -7
View File
@@ -69,21 +69,37 @@ interface XOAuth2Options {
interface NodemailerTransportOptions {
service?: string;
auth?: {
user?: string;
pass?: string;
XOAuthToken?: XOAuthGenerator;
XOAuth2?: XOAuth2Options;
};
auth?: NodemailerAuthInterface;
debug?: bool;
AWSAccessKeyID?: string;
AWSSecretKey: string;
ServiceUrl: string;
}
interface NodemailerAuthInterface {
user?: string;
pass?: string;
XOAuthToken?: XOAuthGenerator;
XOAuth2?: XOAuth2Options;
}
interface NodemailerSMTPTransportOptions {
service?: string;
host?: string;
port?: number;
secureConnection?: bool;
name?: string;
auth: NodemailerAuthInterface;
ignoreTLS?: bool;
debug?: bool;
maxConnections?: number;
}
interface Nodemailer {
createTransport(type: string): Transport;
createTransport(type: string, options: NodemailerTransportOptions): Transport;
createTransport(type: string, options: NodemailerSMTPTransportOptions): Transport;
createTransport(type: string, path: string): Transport;
createXOAuthGenerator(options: XOAuthGeneratorOptions): XOAuthGenerator;
}
}
+8 -1
View File
@@ -199,10 +199,17 @@ interface RequireDefine {
* @return module definition
**/
(name: string, deps: string[], ready: (...deps: any[]) => any): void;
/**
* Defines whether require js supports multiple versions of jQuery being loaded
**/
amd: {
jQuery: bool;
};
}
// Ambient declarations for 'require' and 'define'
declare var require: Require;
declare var requirejs: Require;
declare var req: Require;
declare var define: RequireDefine;
declare var define: RequireDefine;
+16
View File
@@ -0,0 +1,16 @@
// Type definitions for RxJS "Aggregates"
// Project: http://rx.codeplex.com/
// Definitions by: Carl de Billy <http://carl.debilly.net/>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
///<reference path="rx.js.d.ts" />
declare module Rx {
export module Observable {
function all(predicate?: (any) => bool): IObservable;
function min(predicate?: (any) => bool): IObservable;
function max(predicate?: (any) => bool): IObservable;
function count(predicate?: (any) => bool): IObservable;
function sum(keySelector?: (any) => any): IObservable;
}
}
+462 -452
View File
@@ -1,453 +1,463 @@
// Type definitions for RxJS
// Project: http://rx.codeplex.com/
// Definitions by: gsino <http://www.codeplex.com/site/users/view/gsino>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
declare module Rx {
export module Internals {
function inherits(child: Function, parent: Function): Function;
function addProperties(obj: Object, ...sourcces: Object[]): void;
function addRef(xs: IObservable, r: { getDisposable(): _IDisposable; }): IObservable;
}
//Collections
interface IIndexedItem {
id: number;
value: IScheduledItem;
compareTo(other: IIndexedItem): number;
}
// Priority Queue for Scheduling
interface IPriorityQueue {
items: IIndexedItem[];
length: number;
isHigherPriority(left: number, right: number): bool;
percolate(index: number): void;
heapify(index: number): void;
peek(): IIndexedItem;
removeAt(index: number): void;
dequeue(): IIndexedItem;
enqueue(item: IIndexedItem): void;
remove(item: IIndexedItem): bool;
}
interface _IDisposable {
dispose(): void;
}
interface ICompositeDisposable {
disposables: _IDisposable[];
isDisposed: bool;
length: number;
dispose(): void;
add(item: _IDisposable): void;
remove(item: _IDisposable): bool;
clear(): void;
contains(item: _IDisposable): bool;
toArray(): _IDisposable[];
}
export module CompositeDisposable {
function new (...disposables: _IDisposable[]): ICompositeDisposable;
}
// Main disposable class
interface IDisposable {
isDisposed: bool;
action: () =>void;
dispose(): void;
}
export module Disposable {
function new (action: () =>void ): IDisposable;
function create(action: () =>void ): _IDisposable;
var empty: _IDisposable;
}
// Single assignment
interface ISingleAssignmentDisposable {
isDisposed: bool;
current: _IDisposable;
dispose(): void;
disposable(value?: _IDisposable): _IDisposable;
getDisposable(): _IDisposable;
setDisposable(value: _IDisposable): void;
}
export module SingleAssignmentDisposable {
function new (): ISingleAssignmentDisposable;
}
// Multiple assignment disposable
interface ISerialDisposable {
isDisposed: bool;
current: _IDisposable;
dispose(): void;
getDisposable(): _IDisposable;
setDisposable(value: _IDisposable): void;
disposable(value?: _IDisposable): _IDisposable;
}
export module SerialDisposable {
function new (): ISerialDisposable;
}
interface IRefCountDisposable {
underlyingDisposable: _IDisposable;
isDisposed: bool;
isPrimaryDisposed: bool;
count: number;
dispose(): void;
getDisposable(): _IDisposable;
}
export module RefCountDisposable {
function new (disposable: _IDisposable): IRefCountDisposable;
}
interface IScheduledItem {
scheduler: IScheduler;
state: any;
action: (scheduler: IScheduler, state) => _IDisposable;
dueTime: number;
comparer: (x: number, y: number) =>number;
disposable: ISingleAssignmentDisposable;
invoke(): void;
compareTo(other: IScheduledItem): number;
isCancelled(): bool;
invokeCore(): _IDisposable;
}
interface IScheduler {
_schedule: (state: any, action: (scheduler: IScheduler, state: any) =>_IDisposable) => _IDisposable;
_scheduleRelative: (state: any, dueTime: number, action: (scheduler: IScheduler, state: any) =>_IDisposable) =>_IDisposable;
_scheduleAbsolute: (state: any, dueTime: number, action: (scheduler: IScheduler, state: any) =>_IDisposable) =>_IDisposable;
now(): number;
scheduleWithState(state: any, action: (scheduler: IScheduler, state: any) =>_IDisposable): _IDisposable;
scheduleWithAbsoluteAndState(state: any, dueTime: number, action: (scheduler: IScheduler, state: any) =>_IDisposable): _IDisposable;
scheduleWithRelativeAndState(state: any, dueTime: number, action: (scheduler: IScheduler, state: any) =>_IDisposable): _IDisposable;
catchException(handler: (exception: any) =>bool): ICatchScheduler;
schedulePeriodic(period: number, action: () =>void ): _IDisposable;
schedulePeriodicWithState(state: any, period: number, action: (state: any) =>any): _IDisposable;//returns {Disposable|SingleAssignmentDisposable}
schedule(action: () =>void ): _IDisposable;
scheduleWithRelative(dueTime: number, action: () =>void ): _IDisposable;
scheduleWithAbsolute(dueTime: number, action: () =>void ): _IDisposable;
scheduleRecursive(action: (action: () =>void ) =>void ): _IDisposable;
scheduleRecursiveWithState(state: any, action: (state: any, action: (state: any) =>void ) =>void ): _IDisposable;
scheduleRecursiveWithRelative(dueTime: number, action: (action: (dueTime: number) =>void ) =>void ): _IDisposable;
scheduleRecursiveWithRelativeAndState(state: any, dueTime: number, action: (state: any, action: (state: any, dueTime: number) =>void ) =>void ): _IDisposable;
scheduleRecursiveWithAbsolute(dueTime: number, action: (action: (dueTime: number) =>void ) =>void ): _IDisposable;
scheduleRecursiveWithAbsoluteAndState(state: any, dueTime: number, action: (state: any, action: (state: any, dueTime: number) =>void ) =>void ): _IDisposable;
}
export module Scheduler {
function new (now: () =>number,
schedule: (state: any, action: (scheduler: IScheduler, state: any) =>_IDisposable) => _IDisposable,
scheduleRelative: (state: any, dueTime: number, action: (scheduler: IScheduler, state: any) =>_IDisposable) =>_IDisposable,
scheduleAbsolute: (state: any, dueTime: number, action: (scheduler: IScheduler, state: any) =>_IDisposable) =>_IDisposable
): IScheduler;
function now(): number;
function normalize(timeSpan: number): number;
var immediate: IScheduler;
var currentThread: ICurrentScheduler;//IScheduler;
var timeout: IScheduler;
}
// Current Thread IScheduler
interface ICurrentScheduler extends IScheduler {
scheduleRequired(): bool;
ensureTrampoline(action: () =>_IDisposable): _IDisposable;
}
// Virtual IScheduler
interface IVirtualTimeScheduler extends IScheduler {
toRelative(duetime): number;
toDateTimeOffset(duetime: number): number;
clock: number;
comparer: (x: number, y: number) =>number;
isEnabled: bool;
queue: IPriorityQueue;
scheduleRelativeWithState(state: any, dueTime: number, action: (scheduler: IScheduler, state: any) =>_IDisposable): _IDisposable;
scheduleRelative(dueTime: number, action: () =>void ): _IDisposable;
start(): _IDisposable;
stop(): void;
advanceTo(time: number);
advanceBy(time: number);
sleep(time: number);
getNext(): IScheduledItem;
scheduleAbsolute(dueTime: number, action: () =>void );
scheduleAbsoluteWithState(state: any, dueTime: number, action: (scheduler: IScheduler, state: any) =>_IDisposable): _IDisposable;
}
//export module VirtualTimeScheduler {
// //absract
// function new (initialClock: number, comparer: (x: number, y: number) =>number): IVirtualTimeScheduler;
//}
// CatchScheduler
interface ICatchScheduler extends IScheduler { }
// Notifications
interface INotification {
accept(observer: IObserver): void;
accept(onNext: (value: any) =>void , onError?: (exception: any) =>void , onCompleted?: () =>void ): void;
toObservable(scheduler?: IScheduler): IObservable;
hasValue: bool;
equals(other: INotification): bool;
}
export module Notification {
//absctract
//function new (): INotification;
function createOnNext(value: any): INotification;//ON
function createOnError(exception): INotification;//OE
function createOnCompleted(): INotification;//OC
}
export module Internals {
// Enumerator
interface IEnumerator {
moveNext(): bool;
getCurrent(): any;
dispose(): void;
}
export module Enumerator {
function new (moveNext: () =>bool, getCurrent: () => any, dispose: () =>void ): IEnumerator;
function create(moveNext: () =>bool, getCurrent: () =>any, dispose?: () =>void ): IEnumerator;
}
// Enumerable
interface IEnumerable {
getEnumerator(): IEnumerator;
concat(): IObservable;
catchException(): IObservable;
}
export module Enumerable {
function new (getEnumerator: () =>IEnumerator): IEnumerable;
function repeat(value: any, repeatCount?: number): IEnumerable;
function forEach(source: any[], selector?: (element: any, index: number) =>any): IEnumerable;
function forEach(source: { length: number;[index: number]: any; }, selector?: (element: any, index: number) =>any): IEnumerable;
}
}
// Observer
interface IObserver {
onNext(value: any): void;
onError(exception: any): void;
onCompleted(): void;
toNotifier(): (notification: INotification) =>void;
asObserver(): IObserver;
checked(): ICheckedObserver;
}
export module Observer {
//abstract
//function new (): IObserver;
function create(onNext: (value: any) =>void , onError?: (exception: any) =>void , onCompleted?: () =>void ): IObserver;
function fromNotifier(handler: (notification: INotification) =>void ): IObserver;
}
export module Internals {
// Abstract Observer
interface IAbstractObserver extends IObserver {
isStopped: bool;
dispose(): void;
next(value: any): void;
error(exception: any): void;
completed(): void;
fail(): bool;
}
//export module AbstractObserver {
// //abstract
// function new (): IAbstractObserver;
//}
}
interface IAnonymousObserver extends Internals.IAbstractObserver {
_onNext: (value: any) =>void;
_onError: (exception: any) =>void;
_onCompleted: () =>void;
}
export module AnonymousObserver {
function new (onNext: (value: any) =>void , onError: (exception: any) =>void , onCompleted: () =>void ): IAnonymousObserver;
}
interface ICheckedObserver extends IObserver {
_observer: IObserver;
_state: number; // 0 - idle, 1 - busy, 2 - done
checkAccess(): void;
}
export module Internals {
interface IScheduledObserver extends IAbstractObserver {
scheduler: IScheduler;
observer: IObserver;
isAcquired: bool;
hasFaulted: bool;
queue: { (value: any): void; (exception: any): void; (): void; }[];
disposable: ISerialDisposable;
ensureActive(): void;
}
export module ScheduledObserver {
function new (scheduler: IScheduler, observer: IObserver): IScheduledObserver;
}
}
interface IObservable {
_subscribe: (observer: IObserver) =>_IDisposable;
subscribe(observer: IObserver): _IDisposable;
finalValue(): IObservable;
subscribe(onNext?: (value: any) =>void , onError?: (exception: any) =>void , onCompleted?: () =>void ): _IDisposable;
toArray(): IObservable;
observeOn(scheduler: IScheduler): IObservable;
subscribeOn(scheduler: IScheduler): IObservable;
amb(rightSource: IObservable): IObservable;
catchException(handler: (exception: any) =>IObservable): IObservable;
catchException(second: IObservable): IObservable;
combineLatest(second: IObservable, resultSelector: (v1: any, v2: any) =>any): IObservable;
combineLatest(second: IObservable, third: IObservable, resultSelector: (v1: any, v2: any, v3: any) =>any): IObservable;
combineLatest(second: IObservable, third: IObservable, fourth: IObservable, resultSelector: (v1: any, v2: any, v3: any, v4: any) =>any): IObservable;
combineLatest(second: IObservable, third: IObservable, fourth: IObservable, fifth, IObservable, resultSelector: (v1: any, v2: any, v3: any, v4: any, v5: any) =>any): IObservable;
combineLatest(...soucesAndResultSelector: any[]): IObservable;
concat(...sources: IObservable[]): IObservable;
concat(sources: IObservable[]): IObservable;
concatIObservable(): IObservable;
merge(maxConcurrent: number): IObservable;
merge(other: IObservable): IObservable;
mergeIObservable(): IObservable;
onErrorResumeNext(second: IObservable): IObservable;
skipUntil(other: IObservable): IObservable;
switchLatest(): IObservable;
takeUntil(other: IObservable): IObservable;
zip(second: IObservable, resultSelector: (v1: any, v2: any) =>any): IObservable;
zip(second: IObservable, third: IObservable, resultSelector: (v1: any, v2: any, v3: any) =>any): IObservable;
zip(second: IObservable, third: IObservable, fourth: IObservable, resultSelector: (v1: any, v2: any, v3: any, v4: any) =>any): IObservable;
zip(second: IObservable, third: IObservable, fourth: IObservable, fifth, IObservable, resultSelector: (v1: any, v2: any, v3: any, v4: any, v5: any) =>any): IObservable;
zip(...soucesAndResultSelector: any[]): IObservable;
zip(second: any[], resultSelector: (left: any, right: any) =>any): IObservable;
asIObservable(): IObservable;
bufferWithCount(count: number, skip?: number): IObservable;
dematerialize(): IObservable;
distinctUntilChanged(keySelector?: (value: any) =>any, comparer?: (x: any, y: any) =>bool): IObservable;
doAction(observer: IObserver): IObservable;
doAction(onNext: (value: any) => void , onError?: (exception: any) =>void , onCompleted?: () =>void ): IObservable;
finallyAction(action: () =>void ): IObservable;
ignoreElements(): IObservable;
materialize(): IObservable;
repeat(repeatCount?: number): IObservable;
retry(retryCount?: number): IObservable;
scan(seed: number, accumulator: (acc: any, value: any) =>any): IObservable;
scan(accumulator: (acc: any, value: any) =>any): IObservable;
skipLast(count: number): IObservable;
startWith(...values: any[]): IObservable;
startWith(scheduler: IScheduler, ...values: any[]): IObservable;
takeLast(count: number, scheduler?: IScheduler): IObservable;
takeLastBuffer(count: number): IObservable;
windowWithCount(count: number, skip?: number): IObservable;
defaultIfEmpty(defaultValue?: any): IObservable;
distinct(keySelector?: (value: any) =>any, keySerializer?: (key: any) =>string): IObservable;
groupBy(keySelector: (value: any) =>any, elementSelector?: (value: any) =>any, keySerializer?: (key: any) =>string): IGroupedObservable;
groupByUntil(keySelector: (value: any) =>any, elementSelector: (value: any) =>any, durationSelector: (gloup: IGroupedObservable) =>IObservable, keySerializer?: (key: any) =>string): IGroupedObservable;
select(selector: (value: any, index: number) =>any): IObservable;
selectMany(selector: (value: any) =>IObservable, resultSelector?: (x: any, y: any) =>any): IObservable;
selectMany(other: IObservable): IObservable;
skip(count: number): IObservable;
skipWhile(predicate: (value: any, index?: number) =>bool): IObservable;
take(count: number, scheduler?: IScheduler): IObservable;
takeWhile(predicate: (value: any, index?: number) =>bool): IObservable;
where(predicate: (value: any, index?: number) =>bool): IObservable;
}
export module Observable {
function new (subscribe: (observer: IObserver) =>_IDisposable): IObservable;
function start(func: () =>any, scheduler?: IScheduler, context?: any): IObservable;
function toAsync(func: Function, scheduler?: IScheduler, context?: any): (...arguments: any[]) => IObservable;
function create(subscribe: (Observer) =>() =>void ): IObservable;
function createWithDisposable(subscribe: (Observer) =>_IDisposable): IObservable;
function defer(observableFactory: () =>IObservable): IObservable;
function empty(scheduler?: IScheduler): IObservable;
function fromArray(array: any[], scheduler?: IScheduler): IObservable;
function fromArray(array: { length: number;[index: number]: any; }, scheduler?: IScheduler): IObservable;
function generate(initialState: any, condition: (state: any) =>bool, iterate: (state: any) =>any, resultSelector: (state: any) =>any, scheduler?: IScheduler): IObservable;
function never(): IObservable;
function range(start: number, count: number, scheduler?: IScheduler): IObservable;
function repeat(value: any, repeatCount?: number, scheduler?: IScheduler): IObservable;
function returnValue(value: any, scheduler?: IScheduler): IObservable;
function throwException(exception: any, scheduler?: IScheduler): IObservable;
function using(resourceFactory: () =>any, observableFactory: (resource: any) =>IObservable): IObservable;
function amb(...sources: IObservable[]): IObservable;
function catchException(sources: IObservable[]): IObservable;
function catchException(...sources: IObservable[]): IObservable;
function concat(...sources: IObservable[]): IObservable;
function concat(sources: IObservable[]): IObservable;
function merge(...sources: IObservable[]): IObservable;
function merge(sources: IObservable[]): IObservable;
function merge(scheduler: IScheduler, ...sources: IObservable[]): IObservable;
function merge(scheduler: IScheduler, sources: IObservable[]): IObservable;
function onErrorResumeNext(...sources: IObservable[]): IObservable;
function onErrorResumeNext(sources: IObservable[]): IObservable;
}
export module Internals {
interface IAnonymousObservable extends IObservable { }
export module AnonymousObservable {
function new (subscribe: (observer: IObserver) =>_IDisposable): IAnonymousObservable;
}
}
interface IGroupedObservable extends IObservable {
key: any;
underlyingObservable: IObservable;
}
interface ISubject extends IObservable, IObserver {
isDisposed: bool;
isStopped: bool;
observers: IObserver[];
dispose(): void;
}
export module Subject {
function new (): ISubject;
function create(observer: IObserver, observable: IObservable): ISubject;
}
interface IAsyncSubject extends IObservable, IObserver {
isDisposed: bool;
value: any;
hasValue: bool;
observers: IObserver[];
exception: any;
dispose(): void;
}
export module AsyncSubject {
function new (): IAsyncSubject;
}
interface IAnonymousSubject extends IObservable {
onNext(value: any): void;
onError(exception: any): void;
onCompleted(): void;
}
// Type definitions for RxJS
// Project: http://rx.codeplex.com/
// Definitions by: gsino <http://www.codeplex.com/site/users/view/gsino>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
declare module Rx {
export module Internals {
function inherits(child: Function, parent: Function): Function;
function addProperties(obj: Object, ...sourcces: Object[]): void;
function addRef(xs: IObservable, r: { getDisposable(): _IDisposable; }): IObservable;
}
//Collections
interface IIndexedItem {
id: number;
value: IScheduledItem;
compareTo(other: IIndexedItem): number;
}
// Priority Queue for Scheduling
interface IPriorityQueue {
items: IIndexedItem[];
length: number;
isHigherPriority(left: number, right: number): bool;
percolate(index: number): void;
heapify(index: number): void;
peek(): IIndexedItem;
removeAt(index: number): void;
dequeue(): IIndexedItem;
enqueue(item: IIndexedItem): void;
remove(item: IIndexedItem): bool;
}
interface _IDisposable {
dispose(): void;
}
interface ICompositeDisposable {
disposables: _IDisposable[];
isDisposed: bool;
length: number;
dispose(): void;
add(item: _IDisposable): void;
remove(item: _IDisposable): bool;
clear(): void;
contains(item: _IDisposable): bool;
toArray(): _IDisposable[];
}
export module CompositeDisposable {
function new (...disposables: _IDisposable[]): ICompositeDisposable;
}
// Main disposable class
interface IDisposable {
isDisposed: bool;
action: () =>void;
dispose(): void;
}
export module Disposable {
function new (action: () =>void ): IDisposable;
function create(action: () =>void ): _IDisposable;
var empty: _IDisposable;
}
// Single assignment
interface ISingleAssignmentDisposable {
isDisposed: bool;
current: _IDisposable;
dispose(): void;
disposable(value?: _IDisposable): _IDisposable;
getDisposable(): _IDisposable;
setDisposable(value: _IDisposable): void;
}
export module SingleAssignmentDisposable {
function new (): ISingleAssignmentDisposable;
}
// Multiple assignment disposable
interface ISerialDisposable {
isDisposed: bool;
current: _IDisposable;
dispose(): void;
getDisposable(): _IDisposable;
setDisposable(value: _IDisposable): void;
disposable(value?: _IDisposable): _IDisposable;
}
export module SerialDisposable {
function new (): ISerialDisposable;
}
interface IRefCountDisposable {
underlyingDisposable: _IDisposable;
isDisposed: bool;
isPrimaryDisposed: bool;
count: number;
dispose(): void;
getDisposable(): _IDisposable;
}
export module RefCountDisposable {
function new (disposable: _IDisposable): IRefCountDisposable;
}
interface IScheduledItem {
scheduler: IScheduler;
state: any;
action: (scheduler: IScheduler, state) => _IDisposable;
dueTime: number;
comparer: (x: number, y: number) =>number;
disposable: ISingleAssignmentDisposable;
invoke(): void;
compareTo(other: IScheduledItem): number;
isCancelled(): bool;
invokeCore(): _IDisposable;
}
interface IScheduler {
_schedule: (state: any, action: (scheduler: IScheduler, state: any) =>_IDisposable) => _IDisposable;
_scheduleRelative: (state: any, dueTime: number, action: (scheduler: IScheduler, state: any) =>_IDisposable) =>_IDisposable;
_scheduleAbsolute: (state: any, dueTime: number, action: (scheduler: IScheduler, state: any) =>_IDisposable) =>_IDisposable;
now(): number;
scheduleWithState(state: any, action: (scheduler: IScheduler, state: any) =>_IDisposable): _IDisposable;
scheduleWithAbsoluteAndState(state: any, dueTime: number, action: (scheduler: IScheduler, state: any) =>_IDisposable): _IDisposable;
scheduleWithRelativeAndState(state: any, dueTime: number, action: (scheduler: IScheduler, state: any) =>_IDisposable): _IDisposable;
catchException(handler: (exception: any) =>bool): ICatchScheduler;
schedulePeriodic(period: number, action: () =>void ): _IDisposable;
schedulePeriodicWithState(state: any, period: number, action: (state: any) =>any): _IDisposable;//returns {Disposable|SingleAssignmentDisposable}
schedule(action: () =>void ): _IDisposable;
scheduleWithRelative(dueTime: number, action: () =>void ): _IDisposable;
scheduleWithAbsolute(dueTime: number, action: () =>void ): _IDisposable;
scheduleRecursive(action: (action: () =>void ) =>void ): _IDisposable;
scheduleRecursiveWithState(state: any, action: (state: any, action: (state: any) =>void ) =>void ): _IDisposable;
scheduleRecursiveWithRelative(dueTime: number, action: (action: (dueTime: number) =>void ) =>void ): _IDisposable;
scheduleRecursiveWithRelativeAndState(state: any, dueTime: number, action: (state: any, action: (state: any, dueTime: number) =>void ) =>void ): _IDisposable;
scheduleRecursiveWithAbsolute(dueTime: number, action: (action: (dueTime: number) =>void ) =>void ): _IDisposable;
scheduleRecursiveWithAbsoluteAndState(state: any, dueTime: number, action: (state: any, action: (state: any, dueTime: number) =>void ) =>void ): _IDisposable;
}
export module Scheduler {
function new (now: () =>number,
schedule: (state: any, action: (scheduler: IScheduler, state: any) =>_IDisposable) => _IDisposable,
scheduleRelative: (state: any, dueTime: number, action: (scheduler: IScheduler, state: any) =>_IDisposable) =>_IDisposable,
scheduleAbsolute: (state: any, dueTime: number, action: (scheduler: IScheduler, state: any) =>_IDisposable) =>_IDisposable
): IScheduler;
function now(): number;
function normalize(timeSpan: number): number;
var immediate: IScheduler;
var currentThread: ICurrentScheduler;//IScheduler;
var timeout: IScheduler;
}
// Current Thread IScheduler
interface ICurrentScheduler extends IScheduler {
scheduleRequired(): bool;
ensureTrampoline(action: () =>_IDisposable): _IDisposable;
}
// Virtual IScheduler
interface IVirtualTimeScheduler extends IScheduler {
toRelative(duetime): number;
toDateTimeOffset(duetime: number): number;
clock: number;
comparer: (x: number, y: number) =>number;
isEnabled: bool;
queue: IPriorityQueue;
scheduleRelativeWithState(state: any, dueTime: number, action: (scheduler: IScheduler, state: any) =>_IDisposable): _IDisposable;
scheduleRelative(dueTime: number, action: () =>void ): _IDisposable;
start(): _IDisposable;
stop(): void;
advanceTo(time: number);
advanceBy(time: number);
sleep(time: number);
getNext(): IScheduledItem;
scheduleAbsolute(dueTime: number, action: () =>void );
scheduleAbsoluteWithState(state: any, dueTime: number, action: (scheduler: IScheduler, state: any) =>_IDisposable): _IDisposable;
}
//export module VirtualTimeScheduler {
// //absract
// function new (initialClock: number, comparer: (x: number, y: number) =>number): IVirtualTimeScheduler;
//}
// CatchScheduler
interface ICatchScheduler extends IScheduler { }
// Notifications
interface INotification {
accept(observer: IObserver): void;
accept(onNext: (value: any) =>void , onError?: (exception: any) =>void , onCompleted?: () =>void ): void;
toObservable(scheduler?: IScheduler): IObservable;
hasValue: bool;
equals(other: INotification): bool;
}
export module Notification {
//absctract
//function new (): INotification;
function createOnNext(value: any): INotification;//ON
function createOnError(exception): INotification;//OE
function createOnCompleted(): INotification;//OC
}
export module Internals {
// Enumerator
interface IEnumerator {
moveNext(): bool;
getCurrent(): any;
dispose(): void;
}
export module Enumerator {
function new (moveNext: () =>bool, getCurrent: () => any, dispose: () =>void ): IEnumerator;
function create(moveNext: () =>bool, getCurrent: () =>any, dispose?: () =>void ): IEnumerator;
}
// Enumerable
interface IEnumerable {
getEnumerator(): IEnumerator;
concat(): IObservable;
catchException(): IObservable;
}
export module Enumerable {
function new (getEnumerator: () =>IEnumerator): IEnumerable;
function repeat(value: any, repeatCount?: number): IEnumerable;
function forEach(source: any[], selector?: (element: any, index: number) =>any): IEnumerable;
function forEach(source: { length: number;[index: number]: any; }, selector?: (element: any, index: number) =>any): IEnumerable;
}
}
// Observer
interface IObserver {
onNext(value: any): void;
onError(exception: any): void;
onCompleted(): void;
toNotifier(): (notification: INotification) =>void;
asObserver(): IObserver;
checked(): ICheckedObserver;
}
export module Observer {
//abstract
//function new (): IObserver;
function create(onNext: (value: any) =>void , onError?: (exception: any) =>void , onCompleted?: () =>void ): IObserver;
function fromNotifier(handler: (notification: INotification) =>void ): IObserver;
}
export module Internals {
// Abstract Observer
interface IAbstractObserver extends IObserver {
isStopped: bool;
dispose(): void;
next(value: any): void;
error(exception: any): void;
completed(): void;
fail(): bool;
}
//export module AbstractObserver {
// //abstract
// function new (): IAbstractObserver;
//}
}
interface IAnonymousObserver extends Internals.IAbstractObserver {
_onNext: (value: any) =>void;
_onError: (exception: any) =>void;
_onCompleted: () =>void;
}
export module AnonymousObserver {
function new (onNext: (value: any) =>void , onError: (exception: any) =>void , onCompleted: () =>void ): IAnonymousObserver;
}
interface ICheckedObserver extends IObserver {
_observer: IObserver;
_state: number; // 0 - idle, 1 - busy, 2 - done
checkAccess(): void;
}
export module Internals {
interface IScheduledObserver extends IAbstractObserver {
scheduler: IScheduler;
observer: IObserver;
isAcquired: bool;
hasFaulted: bool;
//queue: { (value: any): void; (exception: any): void; (): void; }[];
disposable: ISerialDisposable;
ensureActive(): void;
}
export module ScheduledObserver {
function new (scheduler: IScheduler, observer: IObserver): IScheduledObserver;
}
}
interface IObservable {
_subscribe: (observer: IObserver) =>_IDisposable;
subscribe(observer: IObserver): _IDisposable;
finalValue(): IObservable;
subscribe(onNext?: (value: any) =>void , onError?: (exception: any) =>void , onCompleted?: () =>void ): _IDisposable;
toArray(): IObservable;
observeOn(scheduler: IScheduler): IObservable;
subscribeOn(scheduler: IScheduler): IObservable;
amb(rightSource: IObservable): IObservable;
catchException(handler: (exception: any) =>IObservable): IObservable;
catchException(second: IObservable): IObservable;
combineLatest(second: IObservable, resultSelector: (v1: any, v2: any) =>any): IObservable;
combineLatest(second: IObservable, third: IObservable, resultSelector: (v1: any, v2: any, v3: any) =>any): IObservable;
combineLatest(second: IObservable, third: IObservable, fourth: IObservable, resultSelector: (v1: any, v2: any, v3: any, v4: any) =>any): IObservable;
combineLatest(second: IObservable, third: IObservable, fourth: IObservable, fifth, IObservable, resultSelector: (v1: any, v2: any, v3: any, v4: any, v5: any) =>any): IObservable;
combineLatest(...soucesAndResultSelector: any[]): IObservable;
concat(...sources: IObservable[]): IObservable;
concat(sources: IObservable[]): IObservable;
concatIObservable(): IObservable;
merge(maxConcurrent: number): IObservable;
merge(other: IObservable): IObservable;
mergeIObservable(): IObservable;
onErrorResumeNext(second: IObservable): IObservable;
skipUntil(other: IObservable): IObservable;
switchLatest(): IObservable;
takeUntil(other: IObservable): IObservable;
zip(second: IObservable, resultSelector: (v1: any, v2: any) =>any): IObservable;
zip(second: IObservable, third: IObservable, resultSelector: (v1: any, v2: any, v3: any) =>any): IObservable;
zip(second: IObservable, third: IObservable, fourth: IObservable, resultSelector: (v1: any, v2: any, v3: any, v4: any) =>any): IObservable;
zip(second: IObservable, third: IObservable, fourth: IObservable, fifth, IObservable, resultSelector: (v1: any, v2: any, v3: any, v4: any, v5: any) =>any): IObservable;
zip(...soucesAndResultSelector: any[]): IObservable;
zip(second: any[], resultSelector: (left: any, right: any) =>any): IObservable;
asIObservable(): IObservable;
bufferWithCount(count: number, skip?: number): IObservable;
dematerialize(): IObservable;
distinctUntilChanged(keySelector?: (value: any) =>any, comparer?: (x: any, y: any) =>bool): IObservable;
doAction(observer: IObserver): IObservable;
doAction(onNext: (value: any) => void , onError?: (exception: any) =>void , onCompleted?: () =>void ): IObservable;
finallyAction(action: () =>void ): IObservable;
ignoreElements(): IObservable;
materialize(): IObservable;
repeat(repeatCount?: number): IObservable;
retry(retryCount?: number): IObservable;
scan(seed: any, accumulator: (acc: any, value: any) =>any): IObservable;
scan(accumulator: (acc: any, value: any) =>any): IObservable;
skipLast(count: number): IObservable;
startWith(...values: any[]): IObservable;
startWith(scheduler: IScheduler, ...values: any[]): IObservable;
takeLast(count: number, scheduler?: IScheduler): IObservable;
takeLastBuffer(count: number): IObservable;
windowWithCount(count: number, skip?: number): IObservable;
defaultIfEmpty(defaultValue?: any): IObservable;
distinct(keySelector?: (value: any) =>any, keySerializer?: (key: any) =>string): IObservable;
groupBy(keySelector: (value: any) =>any, elementSelector?: (value: any) =>any, keySerializer?: (key: any) =>string): IGroupedObservable;
groupByUntil(keySelector: (value: any) =>any, elementSelector: (value: any) =>any, durationSelector: (gloup: IGroupedObservable) =>IObservable, keySerializer?: (key: any) =>string): IGroupedObservable;
select(selector: (value: any, index: number) =>any): IObservable;
selectMany(selector: (value: any) =>IObservable, resultSelector?: (x: any, y: any) =>any): IObservable;
selectMany(other: IObservable): IObservable;
skip(count: number): IObservable;
skipWhile(predicate: (value: any, index?: number) =>bool): IObservable;
take(count: number, scheduler?: IScheduler): IObservable;
takeWhile(predicate: (value: any, index?: number) =>bool): IObservable;
where(predicate: (value: any, index?: number) => bool): IObservable;
// time
delay(dueTime: number, scheduler?: IScheduler): IObservable;
throttle(dueTime: number, scheduler?: IScheduler): IObservable;
windowWithTime(dueTime: number, timeShiftOrScheduler?: any, scheduler?: IScheduler): IObservable;
timeInterval(scheduler: IScheduler): IObservable;
sample(interval: number, scheduler?: IScheduler): IObservable;
sample(sampler: IObservable, scheduler?: IScheduler): IObservable;
timeout(dueTime: number, other?: IObservable, scheduler?: IScheduler): IObservable;
delaySubscription(dueTime: number, scheduler?: IScheduler): IObservable;
}
export module Observable {
function new (subscribe: (observer: IObserver) =>_IDisposable): IObservable;
function start(func: () =>any, scheduler?: IScheduler, context?: any): IObservable;
function toAsync(func: Function, scheduler?: IScheduler, context?: any): (...arguments: any[]) => IObservable;
function create(subscribe: (Observer) =>() =>void ): IObservable;
function createWithDisposable(subscribe: (Observer) =>_IDisposable): IObservable;
function defer(observableFactory: () =>IObservable): IObservable;
function empty(scheduler?: IScheduler): IObservable;
function fromArray(array: any[], scheduler?: IScheduler): IObservable;
function fromArray(array: { length: number;[index: number]: any; }, scheduler?: IScheduler): IObservable;
function generate(initialState: any, condition: (state: any) =>bool, iterate: (state: any) =>any, resultSelector: (state: any) =>any, scheduler?: IScheduler): IObservable;
function never(): IObservable;
function range(start: number, count: number, scheduler?: IScheduler): IObservable;
function repeat(value: any, repeatCount?: number, scheduler?: IScheduler): IObservable;
function returnValue(value: any, scheduler?: IScheduler): IObservable;
function throwException(exception: any, scheduler?: IScheduler): IObservable;
function using(resourceFactory: () =>any, observableFactory: (resource: any) =>IObservable): IObservable;
function amb(...sources: IObservable[]): IObservable;
function catchException(sources: IObservable[]): IObservable;
function catchException(...sources: IObservable[]): IObservable;
function concat(...sources: IObservable[]): IObservable;
function concat(sources: IObservable[]): IObservable;
function merge(...sources: IObservable[]): IObservable;
function merge(sources: IObservable[]): IObservable;
function merge(scheduler: IScheduler, ...sources: IObservable[]): IObservable;
function merge(scheduler: IScheduler, sources: IObservable[]): IObservable;
function onErrorResumeNext(...sources: IObservable[]): IObservable;
function onErrorResumeNext(sources: IObservable[]): IObservable;
}
export module Internals {
interface IAnonymousObservable extends IObservable { }
export module AnonymousObservable {
function new (subscribe: (observer: IObserver) =>_IDisposable): IAnonymousObservable;
}
}
interface IGroupedObservable extends IObservable {
key: any;
underlyingObservable: IObservable;
}
interface ISubject extends IObservable, IObserver {
isDisposed: bool;
isStopped: bool;
observers: IObserver[];
dispose(): void;
}
export module Subject {
function new (): ISubject;
function create(observer: IObserver, observable: IObservable): ISubject;
}
interface IAsyncSubject extends IObservable, IObserver {
isDisposed: bool;
value: any;
hasValue: bool;
observers: IObserver[];
exception: any;
dispose(): void;
}
export module AsyncSubject {
function new (): IAsyncSubject;
}
interface IAnonymousSubject extends IObservable {
onNext(value: any): void;
onError(exception: any): void;
onCompleted(): void;
}
}
+6
View File
@@ -0,0 +1,6 @@
declare module Rx {
export module Observable {
function fromEvent(element: HTMLElement, eventName: string) : IObservable;
function fromEvent(document: HTMLDocument, eventName: string): IObservable;
}
}
+10
View File
@@ -0,0 +1,10 @@
///<reference path="rx.js.d.ts" />
declare module Rx {
export module Observable {
function ifThen(condition: () => bool, thenSource: IObservable): IObservable;
function ifThen(condition: () => bool, thenSource: IObservable, elseSource: IObservable): IObservable;
function ifThen(condition: () => bool, thenSource: IObservable, scheduler: IScheduler): IObservable;
function interval(period: number, scheduler?: IScheduler): IObservable;
}
}
+30
View File
@@ -0,0 +1,30 @@
/// <reference path="../chai/chai.d.ts" />
/// <reference path="sinon-chai.d.ts" />
var expect = chai.expect;
function test() {
var spy;
var anotherSpy;
var context;
var match;
expect(spy).to.have.been.called;
expect(spy).to.have.been.calledOnce;
expect(spy).to.have.been.calledTwice;
expect(spy).to.have.been.calledThrice;
expect(spy).to.have.been.calledBefore(anotherSpy);
expect(spy).to.have.been.calledAfter(anotherSpy);
expect(spy).to.have.been.calledOn(context);
expect(spy).to.have.been.alwaysCalledOn(context);
expect(spy).to.have.been.calledWith('foo', 'bar');
expect(spy).to.have.been.alwaysCalledWith('foo', 'bar');
expect(spy).to.have.been.calledWithExactly('foo', 'bar');
expect(spy).to.have.been.alwaysCalledWithExactly('foo', 'bar');
expect(spy).to.have.been.calledWithMatch(match);
expect(spy).to.have.been.alwaysCalledWithMatch(match);
expect(spy).to.have.been.returned(1);
expect(spy).to.have.been.alwaysReturned(1);
expect(spy).to.have.been.threw('an error');
expect(spy).to.have.been.alwaysThrew('an error');
}
+33
View File
@@ -0,0 +1,33 @@
// Type definitions for sinon-chai 2.4.0
// Project: https://github.com/domenic/sinon-chai
// Definitions by: Kazi Manzur Rashid <https://github.com/kazimanzurrashid/>
// DefinitelyTyped: https://github.com/borisyankov/DefinitelyTyped
/// <reference path="../chai/chai.d.ts" />
declare module chai {
interface Been {
called: bool;
calledOnce: bool;
calledTwice: bool;
calledThrice: bool;
calledBefore(spy: any): bool;
calledAfter(spy: any): bool;
calledOn(context: any): bool;
alwaysCalledOn(context: any): bool;
calledWith(...args: any[]): bool;
alwaysCalledWith(...args: any[]): bool;
calledWithExactly(...args: any[]): bool;
alwaysCalledWithExactly(...args: any[]): bool;
calledWithMatch(...args: any[]): bool;
alwaysCalledWithMatch(...args: any[]): bool;
returned(returnVal: any): bool;
alwaysReturned(returnVal: any): bool;
threw(errorObjOrErrorTypeStringOrNothing: any): bool;
alwaysThrew(errorObjOrErrorTypeStringOrNothing: any): bool;
}
interface Have {
been: Been;
}
}