mirror of
https://github.com/wassname/DefinitelyTyped.git
synced 2026-09-09 11:13:57 +08:00
Merge remote-tracking branch 'upstream/master'
This commit is contained in:
@@ -58,6 +58,7 @@ All definitions files include a header with the author and editors, so at some p
|
||||
* [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))
|
||||
* [EasyStar](http://easystarjs.com/) (by [Magnus Gustafsson](https://github.com/Borundin))
|
||||
* [Elm](http://elm-lang.org) (by [Dénes Harmath](https://github.com/thSoft))
|
||||
* [ember.js](http://emberjs.com/) (by [Boris Yankov](https://github.com/borisyankov))
|
||||
* [emissary](https://github.com/atom/emissary) (by [vvakame](https://github.com/vvakame))
|
||||
* [EpicEditor](http://epiceditor.com/) (by [Boris Yankov](https://github.com/borisyankov))
|
||||
|
||||
+14
-11
@@ -5,12 +5,15 @@
|
||||
|
||||
|
||||
/// <reference path="../jquery/jquery.d.ts" />
|
||||
|
||||
/// <reference path="../backbone/backbone.d.ts" />
|
||||
|
||||
declare module Backbone {
|
||||
export class RelationalModel extends Model {
|
||||
static extend(properties:any, classProperties?:any):any; // do not use, prefer TypeScript's extend functionality
|
||||
class RelationalModel extends Model {
|
||||
/**
|
||||
* Do not use, prefer TypeScript's extend functionality.
|
||||
**/
|
||||
//private static extend(properties:any, classProperties?:any):any;
|
||||
|
||||
relations:any;
|
||||
subModelTypes:any;
|
||||
subModelTypeAttribute:any;
|
||||
@@ -58,7 +61,7 @@ declare module Backbone {
|
||||
|
||||
setRelated(related:Model):void;
|
||||
|
||||
setRelated(related:Collection):void;
|
||||
setRelated(related:Collection<Model>):void;
|
||||
|
||||
getReverseRelations(model:RelationalModel):Relation;
|
||||
|
||||
@@ -78,15 +81,15 @@ declare module Backbone {
|
||||
|
||||
setKeyContents(keyContents:number[]):void;
|
||||
|
||||
setKeyContents(keyContents:Collection):void;
|
||||
setKeyContents(keyContents:Collection<Model>):void;
|
||||
|
||||
onChange(model:Model, attr:any, options:any):void;
|
||||
|
||||
handleAddition(model:Model, coll:Collection, options:any):void;
|
||||
handleAddition(model:Model, coll:Collection<Model>, options:any):void;
|
||||
|
||||
handleRemoval(model:Model, coll:Collection, options:any):void;
|
||||
handleRemoval(model:Model, coll:Collection<Model>, options:any):void;
|
||||
|
||||
handleReset(coll:Collection, options:any):void;
|
||||
handleReset(coll:Collection<Model>, options:any):void;
|
||||
|
||||
tryAddRelated(model:Model, coll:any, options:any):void;
|
||||
|
||||
@@ -135,9 +138,9 @@ declare module Backbone {
|
||||
|
||||
processOrphanRelations():void;
|
||||
|
||||
retroFitRelation(relation:RelationalModel, create:boolean):Collection;
|
||||
retroFitRelation(relation:RelationalModel, create:boolean):Collection<Model>;
|
||||
|
||||
getCollection(type:RelationalModel, create:boolean):Collection;
|
||||
getCollection(type:RelationalModel, create:boolean):Collection<Model>;
|
||||
|
||||
getObjectByName(name:string):any;
|
||||
|
||||
@@ -158,7 +161,7 @@ declare module Backbone {
|
||||
|
||||
update(model:RelationalModel):void;
|
||||
|
||||
unregister(model:RelationalModel, collection:Collection, options:any):void;
|
||||
unregister(model:RelationalModel, collection:Collection<Model>, options:any):void;
|
||||
|
||||
reset():void;
|
||||
|
||||
|
||||
+96
-61
@@ -4,7 +4,7 @@
|
||||
function test_events() {
|
||||
|
||||
var object = new Backbone.Events();
|
||||
object.on("alert", (msg) => alert("Triggered " + msg));
|
||||
object.on("alert", (eventName: string) => alert("Triggered " + eventName));
|
||||
|
||||
object.trigger("alert", "an event");
|
||||
|
||||
@@ -18,48 +18,74 @@ function test_events() {
|
||||
object.off();
|
||||
}
|
||||
|
||||
class SettingDefaults extends Backbone.Model {
|
||||
|
||||
// 'defaults' could be set in one of the following ways:
|
||||
|
||||
defaults() {
|
||||
return {
|
||||
name: "Joe"
|
||||
}
|
||||
}
|
||||
|
||||
constructor(attributes?: any, options?: any) {
|
||||
this.defaults = <any>{
|
||||
name: "Joe"
|
||||
}
|
||||
// super has to come last
|
||||
super(attributes, options);
|
||||
}
|
||||
|
||||
// or set it like this
|
||||
initialize() {
|
||||
this.defaults = <any>{
|
||||
name: "Joe"
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// same patterns could be used for setting 'Router.routes' and 'View.events'
|
||||
}
|
||||
|
||||
class Sidebar extends Backbone.Model {
|
||||
|
||||
promptColor() {
|
||||
var cssColor = prompt("Please enter a CSS color:");
|
||||
this.set({ color: cssColor });
|
||||
}
|
||||
}
|
||||
|
||||
class Note extends Backbone.Model {
|
||||
initialize() { }
|
||||
author() { }
|
||||
coordinates() { }
|
||||
allowedToEdit(account: any) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
class PrivateNote extends Note {
|
||||
allowedToEdit(account: any) {
|
||||
return account.owns(this);
|
||||
}
|
||||
|
||||
set(attributes: any, options?: any): Backbone.Model {
|
||||
return Backbone.Model.prototype.set.call(this, attributes, options);
|
||||
}
|
||||
}
|
||||
|
||||
function test_models() {
|
||||
|
||||
var Sidebar = Backbone.Model.extend({
|
||||
promptColor: function () {
|
||||
var cssColor = prompt("Please enter a CSS color:");
|
||||
this.set({ color: cssColor });
|
||||
}
|
||||
});
|
||||
|
||||
var sidebar = new Sidebar();
|
||||
sidebar.on('change:color', (model, color) => $('#sidebar').css({ background: color }));
|
||||
sidebar.on('change:color', (model: {}, color: string) => $('#sidebar').css({ background: color }));
|
||||
sidebar.set({ color: 'white' });
|
||||
sidebar.promptColor();
|
||||
|
||||
////////
|
||||
|
||||
var Note = Backbone.Model.extend({
|
||||
initialize: () => { },
|
||||
author: () => { },
|
||||
coordinates: () => { },
|
||||
allowedToEdit: (account) => {
|
||||
return true;
|
||||
}
|
||||
});
|
||||
|
||||
var PrivateNote = Note.extend({
|
||||
|
||||
allowedToEdit: function (account) {
|
||||
return account.owns(this);
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
//////////
|
||||
|
||||
var note = Backbone.Model.extend({
|
||||
set: function (attributes, options) {
|
||||
Backbone.Model.prototype.set.call(this, attributes, options);
|
||||
}
|
||||
});
|
||||
var note = new PrivateNote();
|
||||
|
||||
note.get("title")
|
||||
note.get("title");
|
||||
|
||||
note.set({ title: "March 20", content: "In his eyes she eclipses..." });
|
||||
|
||||
@@ -69,7 +95,7 @@ function test_models() {
|
||||
class Employee extends Backbone.Model {
|
||||
reports: EmployeeCollection;
|
||||
|
||||
constructor (options? ) {
|
||||
constructor(attributes?: any, options?: any) {
|
||||
super(options);
|
||||
this.reports = new EmployeeCollection();
|
||||
this.reports.url = '../api/employees/' + this.id + '/reports';
|
||||
@@ -80,29 +106,38 @@ class Employee extends Backbone.Model {
|
||||
}
|
||||
}
|
||||
|
||||
class EmployeeCollection extends Backbone.Collection {
|
||||
findByName(key) { }
|
||||
class EmployeeCollection extends Backbone.Collection<Employee> {
|
||||
findByName(key: any) { }
|
||||
}
|
||||
|
||||
class Book extends Backbone.Model {
|
||||
title: string;
|
||||
author: string;
|
||||
}
|
||||
|
||||
class Library extends Backbone.Collection<Book> {
|
||||
model: typeof Book;
|
||||
}
|
||||
|
||||
class Books extends Backbone.Collection<Book> { }
|
||||
|
||||
function test_collection() {
|
||||
var Book: Backbone.Model;
|
||||
var Library = Backbone.Collection.extend({
|
||||
model: Book
|
||||
|
||||
var books = new Library();
|
||||
|
||||
books.each(book => {
|
||||
book.get("title");
|
||||
});
|
||||
|
||||
var Books: Backbone.Collection;
|
||||
|
||||
Books.each(function (book) {
|
||||
});
|
||||
|
||||
var titles = Books.map(function (book) {
|
||||
var titles = books.map(book => {
|
||||
return book.get("title");
|
||||
});
|
||||
|
||||
var publishedBooks = Books.filter(function (book) {
|
||||
var publishedBooks = books.filter(book => {
|
||||
return book.get("published") === true;
|
||||
});
|
||||
|
||||
var alphabetical = Books.sortBy(function (book) {
|
||||
var alphabetical = books.sortBy((book: Book): number => {
|
||||
return null;
|
||||
});
|
||||
}
|
||||
@@ -121,26 +156,26 @@ module v1Changes {
|
||||
|
||||
function test_listenTo() {
|
||||
var model = new Employee;
|
||||
var view = new Backbone.View;
|
||||
var view = new Backbone.View<Employee>();
|
||||
view.listenTo(model, 'invalid', () => { });
|
||||
}
|
||||
|
||||
function test_listenToOnce() {
|
||||
var model = new Employee;
|
||||
var view = new Backbone.View;
|
||||
var view = new Backbone.View<Employee>();
|
||||
view.listenToOnce(model, 'invalid', () => { });
|
||||
}
|
||||
|
||||
function test_stopListening() {
|
||||
var model = new Employee;
|
||||
var view = new Backbone.View;
|
||||
var view = new Backbone.View<Employee>();
|
||||
view.stopListening(model, 'invalid', () => { });
|
||||
view.stopListening(model, 'invalid');
|
||||
view.stopListening(model);
|
||||
}
|
||||
}
|
||||
|
||||
module modelandcollection {
|
||||
module ModelAndCollection {
|
||||
function test_url() {
|
||||
Employee.prototype.url = () => '/employees';
|
||||
EmployeeCollection.prototype.url = () => '/employees';
|
||||
@@ -168,7 +203,7 @@ module v1Changes {
|
||||
}
|
||||
}
|
||||
|
||||
module model {
|
||||
module Model {
|
||||
function test_validationError() {
|
||||
var model = new Employee;
|
||||
if (model.validationError) {
|
||||
@@ -195,17 +230,17 @@ module v1Changes {
|
||||
model.destroy({
|
||||
wait: true,
|
||||
success: (m?, response?, options?) => { },
|
||||
error: (m?, jqxhr?: JQueryXHR, options?) => { }
|
||||
error: (m?, jqxhr?, options?) => { }
|
||||
});
|
||||
|
||||
model.destroy({
|
||||
success: (m?, response?, options?) => { },
|
||||
error: (m?, jqxhr?: JQueryXHR) => { }
|
||||
error: (m?, jqxhr?) => { }
|
||||
});
|
||||
|
||||
model.destroy({
|
||||
success: () => { },
|
||||
error: (m?, jqxhr?: JQueryXHR) => { }
|
||||
error: (m?, jqxhr?) => { }
|
||||
});
|
||||
}
|
||||
|
||||
@@ -220,7 +255,7 @@ module v1Changes {
|
||||
wait: true,
|
||||
validate: false,
|
||||
success: (m?, response?, options?) => { },
|
||||
error: (m?, jqxhr?: JQueryXHR, options?) => { }
|
||||
error: (m?, jqxhr?, options?) => { }
|
||||
});
|
||||
|
||||
model.save({
|
||||
@@ -229,7 +264,7 @@ module v1Changes {
|
||||
},
|
||||
{
|
||||
success: () => { },
|
||||
error: (m?, jqxhr?: JQueryXHR) => { }
|
||||
error: (m?, jqxhr?) => { }
|
||||
});
|
||||
}
|
||||
|
||||
@@ -240,7 +275,7 @@ module v1Changes {
|
||||
}
|
||||
}
|
||||
|
||||
module collection {
|
||||
module Collection {
|
||||
function test_fetch() {
|
||||
var collection = new EmployeeCollection;
|
||||
collection.fetch({ reset: true });
|
||||
@@ -256,7 +291,7 @@ module v1Changes {
|
||||
}
|
||||
}
|
||||
|
||||
module router {
|
||||
module Router {
|
||||
function test_navigate() {
|
||||
var router = new Backbone.Router;
|
||||
|
||||
@@ -264,4 +299,4 @@ module v1Changes {
|
||||
router.navigate('/employees', true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Vendored
+134
-114
@@ -6,6 +6,7 @@
|
||||
|
||||
|
||||
/// <reference path="../jquery/jquery.d.ts" />
|
||||
/// <reference path="../underscore/underscore.d.ts" />
|
||||
|
||||
declare module Backbone {
|
||||
|
||||
@@ -67,7 +68,7 @@ declare module Backbone {
|
||||
}
|
||||
|
||||
class Events {
|
||||
on(eventName: any, callback?: Function, context?: any): any;
|
||||
on(eventName: string, callback?: Function, context?: any): any;
|
||||
off(eventName?: string, callback?: Function, context?: any): any;
|
||||
trigger(eventName: string, ...args: any[]): any;
|
||||
bind(eventName: string, callback: Function, context?: any): any;
|
||||
@@ -86,17 +87,22 @@ declare module Backbone {
|
||||
sync(...arg: any[]): JQueryXHR;
|
||||
}
|
||||
|
||||
interface OptionalDefaults {
|
||||
defaults?(): any;
|
||||
}
|
||||
class Model extends ModelBase {
|
||||
|
||||
class Model extends ModelBase implements OptionalDefaults {
|
||||
|
||||
static extend(properties: any, classProperties?: any): any; // do not use, prefer TypeScript's extend functionality
|
||||
/**
|
||||
* Do not use, prefer TypeScript's extend functionality.
|
||||
**/
|
||||
private static extend(properties: any, classProperties?: any): any;
|
||||
|
||||
attributes: any;
|
||||
changed: any[];
|
||||
cid: string;
|
||||
/**
|
||||
* Default attributes for the model. It can be an object hash or a method returning an object hash.
|
||||
* For assigning an object hash, do it like this: this.defaults = <any>{ attribute: value, ... };
|
||||
* That works only if you set it in the constructor or the initialize method.
|
||||
**/
|
||||
defaults(): any;
|
||||
id: any;
|
||||
idAttribute: string;
|
||||
validationError: any;
|
||||
@@ -127,7 +133,7 @@ declare module Backbone {
|
||||
unset(attribute: string, options?: Silenceable): Model;
|
||||
validate(attributes: any, options?: any): any;
|
||||
|
||||
_validate(attrs: any, options: any): boolean;
|
||||
private _validate(attrs: any, options: any): boolean;
|
||||
|
||||
// mixins from underscore
|
||||
|
||||
@@ -141,115 +147,125 @@ declare module Backbone {
|
||||
omit(...keys: string[]): any;
|
||||
}
|
||||
|
||||
class Collection extends ModelBase {
|
||||
class Collection<TModel extends Model> extends ModelBase {
|
||||
|
||||
static extend(properties: any, classProperties?: any): any; // do not use, prefer TypeScript's extend functionality
|
||||
/**
|
||||
* Do not use, prefer TypeScript's extend functionality.
|
||||
**/
|
||||
private static extend(properties: any, classProperties?: any): any;
|
||||
|
||||
model: any;
|
||||
models: any;
|
||||
collection: Model;
|
||||
// TODO: this really has to be typeof TModel
|
||||
//model: typeof TModel;
|
||||
model: { new(): TModel; }; // workaround
|
||||
models: TModel[];
|
||||
collection: TModel;
|
||||
length: number;
|
||||
|
||||
constructor(models?: any, options?: any);
|
||||
constructor(models?: TModel[], options?: any);
|
||||
|
||||
fetch(options?: CollectionFetchOptions): JQueryXHR;
|
||||
|
||||
comparator(element: Model): any;
|
||||
comparator(compare: Model, to?: Model): any;
|
||||
comparator(element: TModel): number;
|
||||
comparator(compare: TModel, to?: TModel): number;
|
||||
|
||||
add(model: Model, options?: AddOptions): Collection;
|
||||
add(model: any, options?: AddOptions): Collection;
|
||||
add(models: Model[], options?: AddOptions): Collection;
|
||||
add(models: any[], options?: AddOptions): Collection;
|
||||
at(index: number): Model;
|
||||
get(id: any): Model;
|
||||
create(attributes: any, options?: ModelSaveOptions): Model;
|
||||
add(model: TModel, options?: AddOptions): Collection<TModel>;
|
||||
add(models: TModel[], options?: AddOptions): Collection<TModel>;
|
||||
at(index: number): TModel;
|
||||
get(id: string): TModel;
|
||||
create(attributes: any, options?: ModelSaveOptions): TModel;
|
||||
pluck(attribute: string): any[];
|
||||
push(model: Model, options?: AddOptions): Model;
|
||||
pop(options?: Silenceable): Model;
|
||||
remove(model: Model, options?: Silenceable): Model;
|
||||
remove(models: Model[], options?: Silenceable): Model[];
|
||||
reset(models?: Model[], options?: Silenceable): Model[];
|
||||
reset(models?: any[], options?: Silenceable): Model[];
|
||||
set(models?: any[], options?: Silenceable): Model[];
|
||||
shift(options?: Silenceable): Model;
|
||||
sort(options?: Silenceable): Collection;
|
||||
unshift(model: Model, options?: AddOptions): Model;
|
||||
where(properies: any): Model[];
|
||||
findWhere(properties: any): Model;
|
||||
push(model: TModel, options?: AddOptions): TModel;
|
||||
pop(options?: Silenceable): TModel;
|
||||
remove(model: TModel, options?: Silenceable): TModel;
|
||||
remove(models: TModel[], options?: Silenceable): TModel[];
|
||||
reset(models?: TModel[], options?: Silenceable): TModel[];
|
||||
set(models?: TModel[], options?: Silenceable): TModel[];
|
||||
shift(options?: Silenceable): TModel;
|
||||
sort(options?: Silenceable): Collection<TModel>;
|
||||
unshift(model: TModel, options?: AddOptions): TModel;
|
||||
where(properies: any): TModel[];
|
||||
findWhere(properties: any): TModel;
|
||||
|
||||
_prepareModel(attrs?: any, options?: any): any;
|
||||
_removeReference(model: Model): void;
|
||||
_onModelEvent(event: string, model: Model, collection: Collection, options: any): void;
|
||||
private _prepareModel(attrs?: any, options?: any): any;
|
||||
private _removeReference(model: TModel): void;
|
||||
private _onModelEvent(event: string, model: TModel, collection: Collection<TModel>, options: any): void;
|
||||
|
||||
// mixins from underscore
|
||||
|
||||
all(iterator: (element: Model, index: number) => boolean, context?: any): boolean;
|
||||
any(iterator: (element: Model, index: number) => boolean, context?: any): boolean;
|
||||
collect(iterator: (element: Model, index: number, context?: any) => any[], context?: any): any[];
|
||||
all(iterator: (element: TModel, index: number) => boolean, context?: any): boolean;
|
||||
any(iterator: (element: TModel, index: number) => boolean, context?: any): boolean;
|
||||
collect(iterator: (element: TModel, index: number, context?: any) => any[], context?: any): any[];
|
||||
chain(): any;
|
||||
compact(): Model[];
|
||||
compact(): TModel[];
|
||||
contains(value: any): boolean;
|
||||
countBy(iterator: (element: Model, index: number) => any): any[];
|
||||
countBy(attribute: string): any[];
|
||||
countBy(iterator: (element: TModel, index: number) => any): _.Dictionary<number>;
|
||||
countBy(attribute: string): _.Dictionary<number>;
|
||||
detect(iterator: (item: any) => boolean, context?: any): any; // ???
|
||||
difference(...model: Model[]): Model[];
|
||||
drop(): Model;
|
||||
drop(n: number): Model[];
|
||||
each(iterator: (element: Model, index: number, list?: any) => void , context?: any): any;
|
||||
every(iterator: (element: Model, index: number) => boolean, context?: any): boolean;
|
||||
filter(iterator: (element: Model, index: number) => boolean, context?: any): Model[];
|
||||
find(iterator: (element: Model, index: number) => boolean, context?: any): Model;
|
||||
first(): Model;
|
||||
first(n: number): Model[];
|
||||
flatten(shallow?: boolean): Model[];
|
||||
foldl(iterator: (memo: any, element: Model, index: number) => any, initialMemo: any, context?: any): any;
|
||||
forEach(iterator: (element: Model, index: number, list?: any) => void , context?: any): any;
|
||||
difference(...model: TModel[]): TModel[];
|
||||
drop(): TModel;
|
||||
drop(n: number): TModel[];
|
||||
each(iterator: (element: TModel, index: number, list?: any) => void, context?: any): any;
|
||||
every(iterator: (element: TModel, index: number) => boolean, context?: any): boolean;
|
||||
filter(iterator: (element: TModel, index: number) => boolean, context?: any): TModel[];
|
||||
find(iterator: (element: TModel, index: number) => boolean, context?: any): TModel;
|
||||
first(): TModel;
|
||||
first(n: number): TModel[];
|
||||
flatten(shallow?: boolean): TModel[];
|
||||
foldl(iterator: (memo: any, element: TModel, index: number) => any, initialMemo: any, context?: any): any;
|
||||
forEach(iterator: (element: TModel, index: number, list?: any) => void, context?: any): any;
|
||||
groupBy(iterator: (element: TModel, index: number) => string, context?: any): _.Dictionary<TModel[]>;
|
||||
groupBy(attribute: string, context?: any): _.Dictionary<TModel[]>;
|
||||
include(value: any): boolean;
|
||||
indexOf(element: Model, isSorted?: boolean): number;
|
||||
initial(): Model;
|
||||
initial(n: number): Model[];
|
||||
inject(iterator: (memo: any, element: Model, index: number) => any, initialMemo: any, context?: any): any;
|
||||
intersection(...model: Model[]): Model[];
|
||||
indexOf(element: TModel, isSorted?: boolean): number;
|
||||
initial(): TModel;
|
||||
initial(n: number): TModel[];
|
||||
inject(iterator: (memo: any, element: TModel, index: number) => any, initialMemo: any, context?: any): any;
|
||||
intersection(...model: TModel[]): TModel[];
|
||||
isEmpty(object: any): boolean;
|
||||
invoke(methodName: string, arguments?: any[]): any;
|
||||
last(): Model;
|
||||
last(n: number): Model[];
|
||||
lastIndexOf(element: Model, fromIndex?: number): number;
|
||||
map(iterator: (element: Model, index: number, context?: any) => any[], context?: any): any[];
|
||||
max(iterator?: (element: Model, index: number) => any, context?: any): Model;
|
||||
min(iterator?: (element: Model, index: number) => any, context?: any): Model;
|
||||
last(): TModel;
|
||||
last(n: number): TModel[];
|
||||
lastIndexOf(element: TModel, fromIndex?: number): number;
|
||||
map(iterator: (element: TModel, index: number, context?: any) => any[], context?: any): any[];
|
||||
max(iterator?: (element: TModel, index: number) => any, context?: any): TModel;
|
||||
min(iterator?: (element: TModel, index: number) => any, context?: any): TModel;
|
||||
object(...values: any[]): any[];
|
||||
reduce(iterator: (memo: any, element: Model, index: number) => any, initialMemo: any, context?: any): any;
|
||||
reduce(iterator: (memo: any, element: TModel, index: number) => any, initialMemo: any, context?: any): any;
|
||||
select(iterator: any, context?: any): any[];
|
||||
size(): number;
|
||||
shuffle(): any[];
|
||||
some(iterator: (element: Model, index: number) => boolean, context?: any): boolean;
|
||||
sortBy(iterator: (element: Model, index: number) => number, context?: any): Model[];
|
||||
sortBy(attribute: string, context?: any): Model[];
|
||||
sortedIndex(element: Model, iterator?: (element: Model, index: number) => number): number;
|
||||
some(iterator: (element: TModel, index: number) => boolean, context?: any): boolean;
|
||||
sortBy(iterator: (element: TModel, index: number) => number, context?: any): TModel[];
|
||||
sortBy(attribute: string, context?: any): TModel[];
|
||||
sortedIndex(element: TModel, iterator?: (element: TModel, index: number) => number): number;
|
||||
range(stop: number, step?: number): any;
|
||||
range(start: number, stop: number, step?: number): any;
|
||||
reduceRight(iterator: (memo: any, element: Model, index: number) => any, initialMemo: any, context?: any): any[];
|
||||
reject(iterator: (element: Model, index: number) => boolean, context?: any): Model[];
|
||||
rest(): Model;
|
||||
rest(n: number): Model[];
|
||||
tail(): Model;
|
||||
tail(n: number): Model[];
|
||||
reduceRight(iterator: (memo: any, element: TModel, index: number) => any, initialMemo: any, context?: any): any[];
|
||||
reject(iterator: (element: TModel, index: number) => boolean, context?: any): TModel[];
|
||||
rest(): TModel;
|
||||
rest(n: number): TModel[];
|
||||
tail(): TModel;
|
||||
tail(n: number): TModel[];
|
||||
toArray(): any[];
|
||||
union(...model: Model[]): Model[];
|
||||
uniq(isSorted?: boolean, iterator?: (element: Model, index: number) => boolean): Model[];
|
||||
without(...values: any[]): Model[];
|
||||
zip(...model: Model[]): Model[];
|
||||
union(...model: TModel[]): TModel[];
|
||||
uniq(isSorted?: boolean, iterator?: (element: TModel, index: number) => boolean): TModel[];
|
||||
without(...values: any[]): TModel[];
|
||||
zip(...model: TModel[]): TModel[];
|
||||
}
|
||||
|
||||
interface OptionalRoutes {
|
||||
routes?(): any;
|
||||
}
|
||||
class Router extends Events {
|
||||
|
||||
class Router extends Events implements OptionalRoutes {
|
||||
/**
|
||||
* Do not use, prefer TypeScript's extend functionality.
|
||||
**/
|
||||
private static extend(properties: any, classProperties?: any): any;
|
||||
|
||||
static extend(properties: any, classProperties?: any): any; // do not use, prefer TypeScript's extend functionality
|
||||
/**
|
||||
* Routes hash or a method returning the routes hash that maps URLs with parameters to methods on your Router.
|
||||
* For assigning routes as object hash, do it like this: this.routes = <any>{ "route": callback, ... };
|
||||
* That works only if you set it in the constructor or the initialize method.
|
||||
**/
|
||||
routes(): any;
|
||||
|
||||
constructor(options?: RouterOptions);
|
||||
initialize(options?: RouterOptions): void;
|
||||
@@ -257,9 +273,9 @@ declare module Backbone {
|
||||
navigate(fragment: string, options?: NavigateOptions): Router;
|
||||
navigate(fragment: string, trigger?: boolean): Router;
|
||||
|
||||
_bindRoutes(): void;
|
||||
_routeToRegExp(route: string): RegExp;
|
||||
_extractParameters(route: RegExp, fragment: string): string[];
|
||||
private _bindRoutes(): void;
|
||||
private _routeToRegExp(route: string): RegExp;
|
||||
private _extractParameters(route: RegExp, fragment: string): string[];
|
||||
}
|
||||
|
||||
var history: History;
|
||||
@@ -279,14 +295,14 @@ declare module Backbone {
|
||||
loadUrl(fragmentOverride: string): boolean;
|
||||
navigate(fragment: string, options?: any): boolean;
|
||||
started: boolean;
|
||||
options: any;
|
||||
|
||||
_updateHash(location: Location, fragment: string, replace: boolean): void;
|
||||
options: any;
|
||||
|
||||
private _updateHash(location: Location, fragment: string, replace: boolean): void;
|
||||
}
|
||||
|
||||
interface ViewOptions {
|
||||
model?: Backbone.Model;
|
||||
collection?: Backbone.Collection;
|
||||
interface ViewOptions<TModel extends Model> {
|
||||
model?: TModel;
|
||||
collection?: Backbone.Collection<TModel>;
|
||||
el?: any;
|
||||
id?: string;
|
||||
className?: string;
|
||||
@@ -294,35 +310,41 @@ declare module Backbone {
|
||||
attributes?: any[];
|
||||
}
|
||||
|
||||
interface OptionalEvents {
|
||||
events?(): any;
|
||||
}
|
||||
class View<TModel extends Model> extends Events {
|
||||
|
||||
class View extends Events implements OptionalEvents {
|
||||
/**
|
||||
* Do not use, prefer TypeScript's extend functionality.
|
||||
**/
|
||||
private static extend(properties: any, classProperties?: any): any;
|
||||
|
||||
static extend(properties: any, classProperties?: any): any; // do not use, prefer TypeScript's extend functionality
|
||||
constructor(options?: ViewOptions<TModel>);
|
||||
|
||||
constructor(options?: ViewOptions);
|
||||
/**
|
||||
* Events hash or a method returning the events hash that maps events/selectors to methods on your View.
|
||||
* For assigning events as object hash, do it like this: this.events = <any>{ "event:selector": callback, ... };
|
||||
* That works only if you set it in the constructor or the initialize method.
|
||||
**/
|
||||
events(): any;
|
||||
|
||||
$(selector: string): JQuery;
|
||||
model: Model;
|
||||
collection: Collection;
|
||||
make(tagName: string, attrs?: any, opts?: any): View;
|
||||
setElement(element: HTMLElement, delegate?: boolean): View;
|
||||
setElement(element: JQuery, delegate?: boolean): View;
|
||||
model: TModel;
|
||||
collection: Collection<TModel>;
|
||||
//template: (json, options?) => string;
|
||||
make(tagName: string, attrs?: any, opts?: any): View<TModel>;
|
||||
setElement(element: HTMLElement, delegate?: boolean): View<TModel>;
|
||||
setElement(element: JQuery, delegate?: boolean): View<TModel>;
|
||||
id: string;
|
||||
cid: string;
|
||||
className: string;
|
||||
tagName: string;
|
||||
options: any;
|
||||
|
||||
el: any;
|
||||
$el: JQuery;
|
||||
setElement(element: any): View;
|
||||
setElement(element: any): View<TModel>;
|
||||
attributes: any;
|
||||
$(selector: any): JQuery;
|
||||
render(): View;
|
||||
remove(): View;
|
||||
render(): View<TModel>;
|
||||
remove(): View<TModel>;
|
||||
make(tagName: any, attributes?: any, content?: any): any;
|
||||
delegateEvents(events?: any): any;
|
||||
undelegateEvents(): any;
|
||||
@@ -333,14 +355,12 @@ declare module Backbone {
|
||||
// SYNC
|
||||
function sync(method: string, model: Model, options?: JQueryAjaxSettings): any;
|
||||
function ajax(options?: JQueryAjaxSettings): JQueryXHR;
|
||||
var emulateHTTP: boolean;
|
||||
var emulateHTTP: boolean;
|
||||
var emulateJSONBackbone: boolean;
|
||||
|
||||
// Utility
|
||||
function noConflict(): typeof Backbone;
|
||||
function setDomLibrary(jQueryNew: any): any;
|
||||
|
||||
var $: JQueryStatic;
|
||||
}
|
||||
|
||||
declare module "backbone" {
|
||||
|
||||
@@ -23,7 +23,7 @@ class TestModel extends Backbone.Model {
|
||||
|
||||
}
|
||||
|
||||
class TestCollection extends Backbone.Collection {
|
||||
class TestCollection extends Backbone.Collection<TestModel> {
|
||||
|
||||
constructor(models?: any, options?: any) {
|
||||
this.model = TestModel;
|
||||
@@ -41,11 +41,11 @@ class TestCollection extends Backbone.Collection {
|
||||
}
|
||||
}
|
||||
|
||||
class TestView extends Backbone.View {
|
||||
class TestView extends Backbone.View<TestModel> {
|
||||
gridView: Backgrid.Grid;
|
||||
testCollection: TestCollection;
|
||||
|
||||
constructor(viewOptions?: Backbone.ViewOptions) {
|
||||
constructor(viewOptions?: Backbone.ViewOptions<TestModel>) {
|
||||
this.testCollection = new TestCollection();
|
||||
this.gridView = new Backgrid.Grid({
|
||||
columns: [new Backgrid.Column({name: "FirstName", cell: "string", label: "First Name"}),
|
||||
|
||||
Vendored
+10
-10
@@ -9,20 +9,20 @@ declare module Backgrid {
|
||||
|
||||
interface GridOptions {
|
||||
columns: Column[];
|
||||
collection: Backbone.Collection;
|
||||
collection: Backbone.Collection<Backbone.Model>;
|
||||
header: Header;
|
||||
body: Body;
|
||||
row: Row;
|
||||
footer: Footer;
|
||||
}
|
||||
|
||||
class Header extends Backbone.View {
|
||||
class Header extends Backbone.View<Backbone.Model> {
|
||||
}
|
||||
|
||||
class Footer extends Backbone.View {
|
||||
class Footer extends Backbone.View<Backbone.Model> {
|
||||
}
|
||||
|
||||
class Row extends Backbone.View {
|
||||
class Row extends Backbone.View<Backbone.Model> {
|
||||
}
|
||||
|
||||
class Command {
|
||||
@@ -50,19 +50,19 @@ declare module Backgrid {
|
||||
initialize(options?: any);
|
||||
}
|
||||
|
||||
class Body extends Backbone.View {
|
||||
class Body extends Backbone.View<Backbone.Model> {
|
||||
tagName: string;
|
||||
|
||||
initialize(options?: any);
|
||||
insertRow(model: Backbone.Model, collection: Backbone.Collection, options: any);
|
||||
insertRow(model: Backbone.Model, collection: Backbone.Collection<Backbone.Model>, options: any);
|
||||
moveToNextCell(model: Backbone.Model, cell: Column, command: Command);
|
||||
refresh(): Body;
|
||||
remove(): Body;
|
||||
removeRow(model: Backbone.Model, collection: Backbone.Collection, options: any);
|
||||
removeRow(model: Backbone.Model, collection: Backbone.Collection<Backbone.Model>, options: any);
|
||||
render(): Body;
|
||||
}
|
||||
|
||||
class Grid extends Backbone.View {
|
||||
class Grid extends Backbone.View<Backbone.Model> {
|
||||
body: Backgrid.Body;
|
||||
className: string;
|
||||
footer: any;
|
||||
@@ -72,10 +72,10 @@ declare module Backgrid {
|
||||
initialize(options: any);
|
||||
getSelectedModels(): Backbone.Model[];
|
||||
insertColumn(...options: any[]): Grid;
|
||||
insertRow(model: Backbone.Model, collection: Backbone.Collection, options: any);
|
||||
insertRow(model: Backbone.Model, collection: Backbone.Collection<Backbone.Model>, options: any);
|
||||
remove():Grid;
|
||||
removeColumn(...options: any[]): Grid;
|
||||
removeRow(model: Backbone.Model, collection: Backbone.Collection, options: any);
|
||||
removeRow(model: Backbone.Model, collection: Backbone.Collection<Backbone.Model>, options: any);
|
||||
render():Grid;
|
||||
}
|
||||
|
||||
|
||||
Vendored
+2
-2
@@ -382,7 +382,7 @@ declare module breeze {
|
||||
executeQuery(query: EntityQuery, callback?: ExecuteQuerySuccessCallback, errorCallback?: ExecuteQueryErrorCallback): Q.Promise<QueryResult>;
|
||||
|
||||
executeQueryLocally(query: EntityQuery): Entity[];
|
||||
exportEntities(entities?: Entity[]): string;
|
||||
exportEntities(entities?: Entity[], includeMetadata?: boolean): string;
|
||||
fetchEntityByKey(typeName: string, keyValue: any, checkLocalCacheFirst?: boolean): Q.Promise<EntityByKeyResult>;
|
||||
fetchEntityByKey(typeName: string, keyValues: any[], checkLocalCacheFirst?: boolean): Q.Promise<EntityByKeyResult>;
|
||||
fetchEntityByKey(entityKey: EntityKey, checkLocalCacheFirst?: boolean): Q.Promise<EntityByKeyResult>;
|
||||
@@ -877,7 +877,7 @@ declare module breeze.config {
|
||||
var dataService: string;
|
||||
var functionRegistry: Object;
|
||||
export function getAdapter(interfaceName: string, adapterName: string): Object;
|
||||
export function getAdapterInstance(interfaceName: string, adapterName: string): Object;
|
||||
export function getAdapterInstance(interfaceName: string, adapterName?: string): Object;
|
||||
export function initializeAdapterInstance(interfaceName: string, adapterName: string, isDefault: boolean): void;
|
||||
export function initializeAdapterInstances(config: Object): void;
|
||||
var interfaceInitialized: Event;
|
||||
|
||||
+48
-53
@@ -2286,62 +2286,57 @@ function attrObjTest () {
|
||||
.attr({"xlink:href": function(d, i) { return d + "-" + i + ".png"; }});
|
||||
}
|
||||
|
||||
// Test for setting styles as an object
|
||||
// From https://github.com/mbostock/d3/blob/master/test/selection/style-test.js
|
||||
function styleObjTest () {
|
||||
d3.select('body')
|
||||
.style({"background-color": "white", opacity: .42});
|
||||
}
|
||||
|
||||
// Test for setting styles as an object
|
||||
// From https://github.com/mbostock/d3/blob/master/test/selection/property-test.js
|
||||
function propertyObjTest () {
|
||||
d3.select('body')
|
||||
.property({bgcolor: "purple", opacity: .41});
|
||||
}
|
||||
|
||||
|
||||
// Test for brushes
|
||||
// This triggers a bug (shown below) in the 0.9.0 compiler, but works with
|
||||
// 0.9.1 compiler.
|
||||
function brushTest() {
|
||||
var xScale = d3.scale.linear(),
|
||||
yScale = d3.scale.linear();
|
||||
|
||||
// Stack trace:
|
||||
// /usr/local/share/npm/lib/node_modules/typescript/bin/tsc.js:38215
|
||||
// return (type === this.semanticInfoChain.anyTypeSymbol) || type.isError();
|
||||
// ^
|
||||
// TypeError: Cannot call method 'isError' of null
|
||||
// at PullTypeResolver.isAnyOrEquivalent (/usr/local/share/npm/lib/node_modules/typescript/bin/tsc.js:38215:76)
|
||||
// at PullTypeResolver.resolveNameExpression (/usr/local/share/npm/lib/node_modules/typescript/bin/tsc.js:39953:39)
|
||||
// at PullTypeResolver.resolveAST (/usr/local/share/npm/lib/node_modules/typescript/bin/tsc.js:39758:37)
|
||||
// at PullTypeResolver.computeIndexExpressionSymbol (/usr/local/share/npm/lib/node_modules/typescript/bin/tsc.js:40933:37)
|
||||
// at PullTypeResolver.resolveIndexExpression (/usr/local/share/npm/lib/node_modules/typescript/bin/tsc.js:40925:45)
|
||||
// at PullTypeResolver.resolveAST (/usr/local/share/npm/lib/node_modules/typescript/bin/tsc.js:39870:33)
|
||||
// at PullTypeResolver.resolveOverloads (/usr/local/share/npm/lib/node_modules/typescript/bin/tsc.js:42917:43)
|
||||
// at PullTypeResolver.computeCallExpressionSymbol (/usr/local/share/npm/lib/node_modules/typescript/bin/tsc.js:41373:34)
|
||||
// at PullTypeResolver.resolveCallExpression (/usr/local/share/npm/lib/node_modules/typescript/bin/tsc.js:41175:29)
|
||||
// at PullTypeChecker.typeCheckCallExpression (/usr/local/share/npm/lib/node_modules/typescript/bin/tsc.js:45111:58)
|
||||
// at PullTypeChecker.typeCheckAST (/usr/local/share/npm/lib/node_modules/typescript/bin/tsc.js:43786:33)
|
||||
var xMin = 0, xMax = 1,
|
||||
yMin = 0, yMax = 1;
|
||||
|
||||
// function brushTest() {
|
||||
// var xScale = d3.scale.linear(),
|
||||
// yScale = d3.scale.linear();
|
||||
//
|
||||
// var xMin = 0, xMax = 1,
|
||||
// yMin = 0, yMax = 1;
|
||||
//
|
||||
// // Setting only x scale.
|
||||
// var brush1 = d3.svg.brush()
|
||||
// .x(xScale)
|
||||
// .on('brush', function () {
|
||||
// var extent = brush1.extent();
|
||||
// xMin = Math.max(extent[0], 0);
|
||||
// xMax = Math.min(extent[1], 1);
|
||||
// brush1.extent([xMin, xMax]);
|
||||
// });
|
||||
//
|
||||
// // Setting both the x and y scale
|
||||
// var brush2 = d3.svg.brush()
|
||||
// .x(xScale)
|
||||
// .y(yScale)
|
||||
// .on('brush', function () {
|
||||
// var extent = brush2.extent();
|
||||
// var xExtent = extent[0],
|
||||
// yExtent = extent[1];
|
||||
//
|
||||
// xMin = Math.max(xExtent[0], 0);
|
||||
// xMax = Math.min(xExtent[1], 1);
|
||||
//
|
||||
// yMin = Math.max(yExtent[0], 0);
|
||||
// yMax = Math.min(yExtent[1], 1);
|
||||
//
|
||||
// brush1.extent([[xMin, xMax], [yMin, yMax]]);
|
||||
// });
|
||||
// }
|
||||
// Setting only x scale.
|
||||
var brush1 = d3.svg.brush()
|
||||
.x(xScale)
|
||||
.on('brush', function () {
|
||||
var extent = brush1.extent();
|
||||
xMin = Math.max(extent[0], 0);
|
||||
xMax = Math.min(extent[1], 1);
|
||||
brush1.extent([xMin, xMax]);
|
||||
});
|
||||
|
||||
// Setting both the x and y scale
|
||||
var brush2 = d3.svg.brush()
|
||||
.x(xScale)
|
||||
.y(yScale)
|
||||
.on('brush', function () {
|
||||
var extent = brush2.extent();
|
||||
var xExtent = extent[0],
|
||||
yExtent = extent[1];
|
||||
|
||||
xMin = Math.max(xExtent[0], 0);
|
||||
xMax = Math.min(xExtent[1], 1);
|
||||
|
||||
yMin = Math.max(yExtent[0], 0);
|
||||
yMax = Math.min(yExtent[1], 1);
|
||||
|
||||
brush1.extent([[xMin, xMax], [yMin, yMax]]);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
// Tests for area
|
||||
|
||||
Vendored
+3
-1
@@ -710,7 +710,7 @@ declare module D3 {
|
||||
(name: string): string;
|
||||
(name: string, value: any): Selection;
|
||||
(name: string, valueFunction: (data: any, index: number) => any): Selection;
|
||||
(attrValueMap : any): Selection;
|
||||
(attrValueMap : Object): Selection;
|
||||
};
|
||||
|
||||
classed: {
|
||||
@@ -723,12 +723,14 @@ declare module D3 {
|
||||
(name: string): string;
|
||||
(name: string, value: any, priority?: string): Selection;
|
||||
(name: string, valueFunction: (data: any, index: number) => any, priority?: string): Selection;
|
||||
(styleValueMap : Object): Selection;
|
||||
};
|
||||
|
||||
property: {
|
||||
(name: string): void;
|
||||
(name: string, value: any): Selection;
|
||||
(name: string, valueFunction: (data: any, index: number) => any): Selection;
|
||||
(propertyValueMap : Object): Selection;
|
||||
};
|
||||
|
||||
text: {
|
||||
|
||||
@@ -0,0 +1,42 @@
|
||||
/// <reference path="elm.d.ts" />
|
||||
|
||||
// Based on https://gist.github.com/evancz/8521339
|
||||
|
||||
interface Elm {
|
||||
Shanghai: ElmModule<ShanghaiPorts>;
|
||||
}
|
||||
|
||||
interface ShanghaiPorts {
|
||||
coordinates: PortToElm<Array<number>>;
|
||||
incomingShip: PortToElm<Ship>;
|
||||
outgoingShip: PortToElm<string>;
|
||||
totalCapacity: PortFromElm<number>;
|
||||
}
|
||||
|
||||
interface Ship {
|
||||
name: string;
|
||||
capacity: number;
|
||||
}
|
||||
|
||||
// initialize the Shanghai component which keeps track of
|
||||
// shipping data in and out of the Port of Shanghai.
|
||||
var shanghai = Elm.worker(Elm.Shanghai, {
|
||||
coordinates: [0, 0],
|
||||
incomingShip: { name: "", capacity: 0 },
|
||||
outgoingShip: ""
|
||||
});
|
||||
|
||||
function logger(x: any) { console.log(x) }
|
||||
shanghai.ports.totalCapacity.subscribe(logger);
|
||||
// send some ships to the port of Shanghai
|
||||
shanghai.ports.incomingShip.send({
|
||||
name: "Mary Mærsk",
|
||||
capacity: 18270
|
||||
});
|
||||
shanghai.ports.incomingShip.send({
|
||||
name: "Emma Mærsk",
|
||||
capacity: 15500
|
||||
});
|
||||
// have those ships leave the port of Shanghai
|
||||
shanghai.ports.outgoingShip.send("Mary Mærsk");
|
||||
shanghai.ports.outgoingShip.send("Emma Mærsk");
|
||||
Vendored
+28
@@ -0,0 +1,28 @@
|
||||
// Type definitions for Elm 0.12
|
||||
// Project: http://elm-lang.org
|
||||
// Definitions by: Dénes Harmath <https://github.com/thSoft>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
declare var Elm: Elm;
|
||||
|
||||
interface Elm {
|
||||
embed<P>(elmModule: ElmModule<P>, element: Node, initialValues?: Object): ElmComponent<P>;
|
||||
fullscreen<P>(elmModule: ElmModule<P>, initialValues?: Object): ElmComponent<P>;
|
||||
worker<P>(elmModule: ElmModule<P>, initialValues?: Object): ElmComponent<P>;
|
||||
}
|
||||
|
||||
interface ElmModule<P> {
|
||||
}
|
||||
|
||||
interface ElmComponent<P> {
|
||||
ports: P;
|
||||
}
|
||||
|
||||
interface PortToElm<V> {
|
||||
send(value: V): void;
|
||||
}
|
||||
|
||||
interface PortFromElm<V> {
|
||||
subscribe(handler: (value: V) => void): void;
|
||||
unsubscribe(handler: (value: V) => void): void;
|
||||
}
|
||||
@@ -3,13 +3,13 @@
|
||||
class User extends Giraffe.Model {
|
||||
}
|
||||
|
||||
class MainView extends Giraffe.View {
|
||||
class MainView extends Giraffe.View<User> {
|
||||
|
||||
constructor(options?) {
|
||||
this.appEvents = {
|
||||
'startup': 'app_onStartup'
|
||||
}
|
||||
super(options)
|
||||
}
|
||||
super(options);
|
||||
}
|
||||
|
||||
app_onStartup() {
|
||||
@@ -23,15 +23,15 @@ class MyApp extends Giraffe.App {
|
||||
this.routes= {
|
||||
'': 'home'
|
||||
}
|
||||
super()
|
||||
super();
|
||||
}
|
||||
|
||||
home() {
|
||||
this.attach( new MainView )
|
||||
this.attach(new MainView);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
var app= new MyApp();
|
||||
|
||||
app.start();
|
||||
app.start();
|
||||
|
||||
Vendored
+38
-37
@@ -38,8 +38,8 @@ declare module Giraffe {
|
||||
interface AppMap {
|
||||
[ cid:string ]: App;
|
||||
}
|
||||
interface ViewMap {
|
||||
[ cid:string ]: View;
|
||||
interface ViewMap<TModel extends Model> {
|
||||
[ cid:string ]: View<TModel>;
|
||||
}
|
||||
interface StringMap {
|
||||
[ def:string ]: string;
|
||||
@@ -49,7 +49,7 @@ declare module Giraffe {
|
||||
var apps: AppMap;
|
||||
var defaultOptions: DefaultOptions;
|
||||
var version: string;
|
||||
var views: ViewMap;
|
||||
var views: ViewMap<Model>;
|
||||
|
||||
function bindAppEvents( instance:GiraffeObject ): GiraffeObject;
|
||||
function bindDataEvents( instance:GiraffeObject ): GiraffeObject;
|
||||
@@ -64,9 +64,10 @@ declare module Giraffe {
|
||||
|
||||
function wrapFn( obj:any, name:string, before:Function, after:Function);
|
||||
|
||||
class Collection extends Backbone.Collection implements GiraffeObject {
|
||||
class Collection<TModel extends Model> extends Backbone.Collection<TModel> implements GiraffeObject {
|
||||
app: App;
|
||||
model: Model;
|
||||
//model: typeof TModel;
|
||||
model: { new (): TModel; }; // workaround
|
||||
}
|
||||
|
||||
class Model extends Backbone.Model implements GiraffeObject {
|
||||
@@ -85,46 +86,46 @@ declare module Giraffe {
|
||||
reload( url:string );
|
||||
}
|
||||
|
||||
class View extends Backbone.View implements GiraffeObject {
|
||||
class View<TModel extends Model> extends Backbone.View<TModel> implements GiraffeObject {
|
||||
app: App;
|
||||
appEvents: StringMap;
|
||||
children: View[];
|
||||
children: View<TModel>[];
|
||||
dataEvents: StringMap;
|
||||
defaultOptions: DefaultOptions;
|
||||
documentTitle: string;
|
||||
parent: View;
|
||||
parent: View<TModel>;
|
||||
template: any;
|
||||
ui: StringMap;
|
||||
|
||||
attachTo( el:any, options?:AttachmentOptions ): View;
|
||||
attach( view:View, options?:AttachmentOptions ): View;
|
||||
attachTo( el:any, options?:AttachmentOptions ): View<TModel>;
|
||||
attach( view:View<TModel>, options?:AttachmentOptions ): View<TModel>;
|
||||
isAttached( el:any ): boolean;
|
||||
|
||||
render( options?:any ): View;
|
||||
render( options?:any ): View<TModel>;
|
||||
beforeRender();
|
||||
afterRender();
|
||||
templateStrategy(): string;
|
||||
serialize(): any;
|
||||
|
||||
setParent( parent:View ): View;
|
||||
setParent( parent:View<TModel> ): View<TModel>;
|
||||
|
||||
addChild( child:View ): View;
|
||||
addChildren( children:View[] ): View;
|
||||
removeChild( child:View, preserve?:boolean ): View;
|
||||
removeChildren( preserve?:boolean ): View;
|
||||
addChild( child:View<TModel> ): View<TModel>;
|
||||
addChildren( children:View<TModel>[] ): View<TModel>;
|
||||
removeChild( child:View<TModel>, preserve?:boolean ): View<TModel>;
|
||||
removeChildren( preserve?:boolean ): View<TModel>;
|
||||
|
||||
detach( preserve?:boolean ): View;
|
||||
detachChildren( preserve?:boolean ): View;
|
||||
detach( preserve?:boolean ): View<TModel>;
|
||||
detachChildren( preserve?:boolean ): View<TModel>;
|
||||
|
||||
invoke( method:string, ...args:any[] );
|
||||
|
||||
dispose(): View;
|
||||
beforeDispose(): View;
|
||||
afterDispose(): View;
|
||||
dispose(): View<TModel>;
|
||||
beforeDispose(): View<TModel>;
|
||||
afterDispose(): View<TModel>;
|
||||
|
||||
static detachByElement( el:any, preserve?:boolean ): View;
|
||||
static getClosestView( el:any ): View;
|
||||
static getByCid( cid:string ): View;
|
||||
static detachByElement( el:any, preserve?:boolean ): View<Model>;
|
||||
static getClosestView<TModel>( el:any ): View<Model>;
|
||||
static getByCid( cid:string ): View<Model>;
|
||||
static to$El( el:any, parent?:any, allowParentMatch?:boolean ): JQuery;
|
||||
static setDocumentEvents( events:string[], prefix?:string ): string[];
|
||||
static removeDocumentEvents( prefix?:string );
|
||||
@@ -132,7 +133,7 @@ declare module Giraffe {
|
||||
static setTemplateStrategy( strategy:any, instance?:any );
|
||||
}
|
||||
|
||||
class App extends View {
|
||||
class App extends View<Model> {
|
||||
routes: StringMap;
|
||||
|
||||
addInitializer( initializer:( options?:any, callback?:()=>void )=>void ): App;
|
||||
@@ -146,23 +147,23 @@ declare module Giraffe {
|
||||
app: App;
|
||||
}
|
||||
|
||||
class CollectionView extends View {
|
||||
class CollectionView<TModel extends Model> extends View<TModel> {
|
||||
|
||||
collection: Collection;
|
||||
modelView: View;
|
||||
collection: Collection<TModel>;
|
||||
modelView: View<TModel>;
|
||||
modelViewArgs: any[];
|
||||
modelViewEl: any;
|
||||
renderOnChange: boolean;
|
||||
|
||||
findByModel( model:Model ): View;
|
||||
addOne( model:Model ): View;
|
||||
removeOne( model:Model ): View;
|
||||
findByModel( model:Model ): View<TModel>;
|
||||
addOne( model:Model ): View<TModel>;
|
||||
removeOne( model:Model ): View<TModel>;
|
||||
|
||||
static getDefaults( ctx:any ): any;
|
||||
}
|
||||
|
||||
class FastCollectionView extends View {
|
||||
collection: Collection;
|
||||
class FastCollectionView<TModel extends Model> extends View<TModel> {
|
||||
collection: Collection<TModel>;
|
||||
modelTemplate: any;
|
||||
modelTemplateStrategy: string;
|
||||
modelEl: any;
|
||||
@@ -170,11 +171,11 @@ declare module Giraffe {
|
||||
|
||||
modelSerialize(): any;
|
||||
|
||||
addAll(): View;
|
||||
addOne( model:Model ): View;
|
||||
removeOne( model:Model ): View;
|
||||
addAll(): View<TModel>;
|
||||
addOne( model:Model ): View<TModel>;
|
||||
removeOne( model:Model ): View<TModel>;
|
||||
|
||||
removeByIndex( index:number ): View;
|
||||
removeByIndex( index:number ): View<TModel>;
|
||||
findElByModel( model:Model ): JQuery;
|
||||
findElByIndex( index:number ): JQuery;
|
||||
findModelByEl( el:any ): Model;
|
||||
|
||||
Vendored
+9
-5
@@ -38,20 +38,19 @@ declare module joint {
|
||||
attr(attrs: any): Cell;
|
||||
}
|
||||
|
||||
|
||||
|
||||
class Element extends Cell {
|
||||
position(x: number, y: number): Element;
|
||||
translate(tx: number, ty?: number): Element;
|
||||
resize(width: number, height: number): Element;
|
||||
rotate(angle: number, absolute): Element;
|
||||
}
|
||||
|
||||
interface IDefaults {
|
||||
type: string;
|
||||
}
|
||||
|
||||
class Link extends Cell {
|
||||
defaults: IDefaults;
|
||||
defaults(): IDefaults;
|
||||
disconnect(): Link;
|
||||
label(idx?: number, value?: any): any; // @todo: returns either a label under idx or Link if both idx and value were passed
|
||||
}
|
||||
@@ -65,7 +64,7 @@ declare module joint {
|
||||
linkView: LinkView;
|
||||
}
|
||||
|
||||
class Paper extends Backbone.View {
|
||||
class Paper extends Backbone.View<Backbone.Model> {
|
||||
options: IOptions;
|
||||
setDimensions(width: number, height: number);
|
||||
scale(sx: number, sy?: number, ox?: number, oy?: number): Paper;
|
||||
@@ -80,7 +79,8 @@ declare module joint {
|
||||
class ElementView extends CellView {
|
||||
scale(sx: number, sy: number);
|
||||
}
|
||||
class CellView extends Backbone.View {
|
||||
|
||||
class CellView extends Backbone.View<Cell> {
|
||||
getBBox(): { x: number; y: number; width: number; height: number; };
|
||||
highlight(el?: any);
|
||||
unhighlight(el?: any);
|
||||
@@ -94,7 +94,9 @@ declare module joint {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
module ui { }
|
||||
|
||||
module shapes {
|
||||
module basic {
|
||||
class Generic extends joint.dia.Element { }
|
||||
@@ -104,6 +106,7 @@ declare module joint {
|
||||
class Image extends Generic { }
|
||||
}
|
||||
}
|
||||
|
||||
module util {
|
||||
function uuid(): string;
|
||||
function guid(obj: any): string;
|
||||
@@ -112,4 +115,5 @@ declare module joint {
|
||||
function deepMixin(objects: any[]): any;
|
||||
function deepSupplement(objects: any[], defaultIndicator?: any): any;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Vendored
+31
-1
@@ -1512,7 +1512,37 @@ interface JQuery {
|
||||
*
|
||||
* @param func A function returning the value to set. this is the current element. Receives the index position of the element in the set and the old value as arguments.
|
||||
*/
|
||||
val(func: (index: number, value: any) => any): JQuery;
|
||||
val(func: (index: number, value: string) => string): JQuery;
|
||||
/**
|
||||
* Set the value of each element in the set of matched elements.
|
||||
*
|
||||
* @param func A function returning the value to set. this is the current element. Receives the index position of the element in the set and the old value as arguments.
|
||||
*/
|
||||
val(func: (index: number, value: string[]) => string): JQuery;
|
||||
/**
|
||||
* Set the value of each element in the set of matched elements.
|
||||
*
|
||||
* @param func A function returning the value to set. this is the current element. Receives the index position of the element in the set and the old value as arguments.
|
||||
*/
|
||||
val(func: (index: number, value: number) => string): JQuery;
|
||||
/**
|
||||
* Set the value of each element in the set of matched elements.
|
||||
*
|
||||
* @param func A function returning the value to set. this is the current element. Receives the index position of the element in the set and the old value as arguments.
|
||||
*/
|
||||
val(func: (index: number, value: string) => string[]): JQuery;
|
||||
/**
|
||||
* Set the value of each element in the set of matched elements.
|
||||
*
|
||||
* @param func A function returning the value to set. this is the current element. Receives the index position of the element in the set and the old value as arguments.
|
||||
*/
|
||||
val(func: (index: number, value: string[]) => string[]): JQuery;
|
||||
/**
|
||||
* Set the value of each element in the set of matched elements.
|
||||
*
|
||||
* @param func A function returning the value to set. this is the current element. Receives the index position of the element in the set and the old value as arguments.
|
||||
*/
|
||||
val(func: (index: number, value: number) => string[]): JQuery;
|
||||
|
||||
/**
|
||||
* Get the value of style properties for the first element in the set of matched elements.
|
||||
|
||||
Vendored
+3
-3
@@ -126,8 +126,8 @@ declare module Knockback {
|
||||
}
|
||||
|
||||
interface CollectionObservable extends KnockoutObservableArray<any> {
|
||||
collection(colleciton: Backbone.Collection);
|
||||
collection(): Backbone.Collection;
|
||||
collection(colleciton: Backbone.Collection<Backbone.Model>);
|
||||
collection(): Backbone.Collection<Backbone.Model>;
|
||||
destroy();
|
||||
shareOptions(): CollectionOptions;
|
||||
filters(id: any) : Backbone.Model;
|
||||
@@ -163,7 +163,7 @@ declare module Knockback {
|
||||
}
|
||||
|
||||
interface Static extends Utils {
|
||||
collectionObservable(model?: Backbone.Collection, options?: CollectionOptions): CollectionObservable;
|
||||
collectionObservable(model?: Backbone.Collection<Backbone.Model>, options?: CollectionOptions): CollectionObservable;
|
||||
/** Base class for observing model attributes. */
|
||||
observable(
|
||||
/** the model to observe (can be null) */
|
||||
|
||||
Vendored
+11
-1
@@ -497,6 +497,16 @@ declare module "less" {
|
||||
toCSS(env?: Options): string;
|
||||
eval(): UnicodeDescriptor;
|
||||
}
|
||||
|
||||
export class Attribute implements IInjectable {
|
||||
constructor(value: string);
|
||||
|
||||
value: string;
|
||||
|
||||
toCSS(env?: Options): string;
|
||||
genCSS(env: Options, output): string;
|
||||
eval(): Attribute;
|
||||
}
|
||||
|
||||
export var debugInfo: DebugInfoFunction;
|
||||
export function find(obj: any[], fun: Function): any;
|
||||
@@ -539,4 +549,4 @@ declare module "less" {
|
||||
export function writeError(ctx, options: { color: boolean; }): void;
|
||||
|
||||
export var version: number[];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
/// <reference path="lockfile.d.ts" />
|
||||
|
||||
import lockfile = require('lockfile');
|
||||
|
||||
var bool: boolean;
|
||||
var num: number;
|
||||
var path: string;
|
||||
|
||||
var opts: lockfile.Options;
|
||||
var callback: (err: Error) => {
|
||||
|
||||
};
|
||||
|
||||
opts = {
|
||||
wait: num,
|
||||
stale: num,
|
||||
retries: num,
|
||||
retryWait: num
|
||||
};
|
||||
|
||||
lockfile.lock(path, opts, callback);
|
||||
lockfile.lock(path, callback);
|
||||
lockfile.lockSync(path, opts);
|
||||
|
||||
lockfile.unlock(path, callback);;
|
||||
lockfile.unlockSync(path);
|
||||
|
||||
lockfile.check(path, opts, callback);
|
||||
lockfile.check(path, callback);
|
||||
|
||||
bool = lockfile.checkSync(path, opts);
|
||||
Vendored
+24
@@ -0,0 +1,24 @@
|
||||
// Type definitions for lockfile v0.4.2
|
||||
// Project: https://github.com/isaacs/lockfile
|
||||
// Definitions by: Bart van der Schoor <https://github.com/Bartvds>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
declare module 'lockfile' {
|
||||
export interface Options {
|
||||
wait?: number;
|
||||
stale?: number;
|
||||
retries?: number;
|
||||
retryWait?: number;
|
||||
}
|
||||
|
||||
export function lock(path: string, opts: Options, callback: (err: Error) => void): void;
|
||||
export function lock(path: string, callback: (err: Error) => void): void;
|
||||
export function lockSync(path: string, opts: Options):void;
|
||||
|
||||
export function unlock(path: string, callback: (err: Error) => void): void;
|
||||
export function unlockSync(path: string):void;
|
||||
|
||||
export function check(path: string, opts: Options, callback: (err: Error) => void): void;
|
||||
export function check(path: string, callback: (err: Error) => void): void;
|
||||
export function checkSync(path: string, opts: Options): boolean;
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
/// <reference path="lru-cache.d.ts" />
|
||||
|
||||
import lru = require('lru-cache');
|
||||
|
||||
var x: any;
|
||||
var num: number;
|
||||
var bool: boolean;
|
||||
var key: string;
|
||||
var strArr: string[];
|
||||
|
||||
interface Foo {
|
||||
foo(): void;
|
||||
}
|
||||
|
||||
var foo: Foo;
|
||||
var fooArr: Foo[];
|
||||
|
||||
var opts: lru.Options<any>;
|
||||
opts = {
|
||||
max: num,
|
||||
maxAge: num,
|
||||
stale: bool
|
||||
};
|
||||
var cache: lru.Cache<Foo> = lru<Foo>({
|
||||
max: num,
|
||||
maxAge: num,
|
||||
length: (value: Foo) => {
|
||||
return num
|
||||
},
|
||||
dispose: (key: string, value: Foo) => {
|
||||
|
||||
},
|
||||
stale: bool
|
||||
});
|
||||
|
||||
cache = lru<Foo>(num);
|
||||
|
||||
cache.set(key, foo);
|
||||
foo = cache.get(key);
|
||||
foo = cache.peek(key);
|
||||
bool = cache.has(key);
|
||||
cache.del(key);
|
||||
cache.reset();
|
||||
|
||||
cache.forEach((value: Foo, key: string, cache: lru.Cache<Foo>) => {
|
||||
|
||||
});
|
||||
cache.forEach((value: Foo, key: string, cache: lru.Cache<Foo>) => {
|
||||
|
||||
}, x);
|
||||
cache.forEach((value, key, cache) => {
|
||||
foo = cache.peek(key);
|
||||
});
|
||||
|
||||
strArr = cache.keys();
|
||||
fooArr = cache.values();
|
||||
Vendored
+34
@@ -0,0 +1,34 @@
|
||||
// Type definitions for lru-cache v2.5.0
|
||||
// Project: https://github.com/isaacs/node-lru-cache
|
||||
// Definitions by: Bart van der Schoor <https://github.com/Bartvds>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
declare module 'lru-cache' {
|
||||
function LRU<T>(opts: LRU.Options<T>): LRU.Cache<T>;
|
||||
function LRU<T>(max: number): LRU.Cache<T>;
|
||||
|
||||
module LRU {
|
||||
interface Options<T> {
|
||||
max?: number;
|
||||
maxAge?: number;
|
||||
length?: (value: T) => number;
|
||||
dispose?: (key: string, value: T) => void;
|
||||
stale?: boolean;
|
||||
}
|
||||
|
||||
interface Cache<T> {
|
||||
set(key: string, value: T): void;
|
||||
get(key: string): T;
|
||||
peek(key: string): T;
|
||||
has(key: string): boolean
|
||||
del(key: string): void;
|
||||
reset(): void;
|
||||
forEach(iter: (value: T, key: string, cache: Cache<T>) => void, thisp?: any): void;
|
||||
|
||||
keys(): string[];
|
||||
values(): T[];
|
||||
}
|
||||
}
|
||||
|
||||
export = LRU;
|
||||
}
|
||||
Vendored
+82
-82
@@ -11,49 +11,49 @@
|
||||
declare module Backbone {
|
||||
|
||||
// Backbone.BabySitter
|
||||
class ChildViewContainer {
|
||||
class ChildViewContainer<TModel extends Backbone.Model> {
|
||||
|
||||
constructor(initialViews?: any[]);
|
||||
|
||||
add(view: View, customIndex?: number);
|
||||
findByModel(model): View;
|
||||
findByModelCid(modelCid): View;
|
||||
findByCustom(index: number): View;
|
||||
findByIndex(index: number): View;
|
||||
findByCid(cid): View;
|
||||
remove(view: View);
|
||||
add(view: View<TModel>, customIndex?: number);
|
||||
findByModel(model): View<TModel>;
|
||||
findByModelCid(modelCid): View<TModel>;
|
||||
findByCustom(index: number): View<TModel>;
|
||||
findByIndex(index: number): View<TModel>;
|
||||
findByCid(cid): View<TModel>;
|
||||
remove(view: View<TModel>);
|
||||
call(method);
|
||||
apply(method: any, args?: any[]);
|
||||
|
||||
//mixins from Collection (copied from Backbone's Collection declaration)
|
||||
|
||||
all(iterator: (element: View, index: number) => boolean, context?: any): boolean;
|
||||
any(iterator: (element: View, index: number) => boolean, context?: any): boolean;
|
||||
all(iterator: (element: View<TModel>, index: number) => boolean, context?: any): boolean;
|
||||
any(iterator: (element: View<TModel>, index: number) => boolean, context?: any): boolean;
|
||||
contains(value: any): boolean;
|
||||
detect(iterator: (item: any) => boolean, context?: any): any;
|
||||
each(iterator: (element: View, index: number, list?: any) => void , context?: any);
|
||||
every(iterator: (element: View, index: number) => boolean, context?: any): boolean;
|
||||
filter(iterator: (element: View, index: number) => boolean, context?: any): View[];
|
||||
find(iterator: (element: View, index: number) => boolean, context?: any): View;
|
||||
first(): View;
|
||||
forEach(iterator: (element: View, index: number, list?: any) => void , context?: any);
|
||||
each(iterator: (element: View<TModel>, index: number, list?: any) => void , context?: any);
|
||||
every(iterator: (element: View<TModel>, index: number) => boolean, context?: any): boolean;
|
||||
filter(iterator: (element: View<TModel>, index: number) => boolean, context?: any): View<TModel>[];
|
||||
find(iterator: (element: View<TModel>, index: number) => boolean, context?: any): View<TModel>;
|
||||
first(): View<TModel>;
|
||||
forEach(iterator: (element: View<TModel>, index: number, list?: any) => void , context?: any);
|
||||
include(value: any): boolean;
|
||||
initial(): View;
|
||||
initial(n: number): View[];
|
||||
initial(): View<TModel>;
|
||||
initial(n: number): View<TModel>[];
|
||||
invoke(methodName: string, arguments?: any[]);
|
||||
isEmpty(object: any): boolean;
|
||||
last(): View;
|
||||
last(n: number): View[];
|
||||
lastIndexOf(element: View, fromIndex?: number): number;
|
||||
map(iterator: (element: View, index: number, context?: any) => any[], context?: any): any[];
|
||||
last(): View<TModel>;
|
||||
last(n: number): View<TModel>[];
|
||||
lastIndexOf(element: View<TModel>, fromIndex?: number): number;
|
||||
map(iterator: (element: View<TModel>, index: number, context?: any) => any[], context?: any): any[];
|
||||
pluck(attribute: string): any[];
|
||||
reject(iterator: (element: View, index: number) => boolean, context?: any): View[];
|
||||
rest(): View;
|
||||
rest(n: number): View[];
|
||||
reject(iterator: (element: View<TModel>, index: number) => boolean, context?: any): View<TModel>[];
|
||||
rest(): View<TModel>;
|
||||
rest(n: number): View<TModel>[];
|
||||
select(iterator: any, context?: any): any[];
|
||||
some(iterator: (element: View, index: number) => boolean, context?: any): boolean;
|
||||
some(iterator: (element: View<TModel>, index: number) => boolean, context?: any): boolean;
|
||||
toArray(): any[];
|
||||
without(...values: any[]): View[];
|
||||
without(...values: any[]): View<TModel>[];
|
||||
}
|
||||
|
||||
// Backbone.Wreqr
|
||||
@@ -107,7 +107,7 @@ declare module Marionette {
|
||||
|
||||
function getOption(target, optionName): any;
|
||||
function triggerMethod(name, ...args: any[]): any;
|
||||
function MonitorDOMRefresh(view: Backbone.View): void;
|
||||
function MonitorDOMRefresh(view: Backbone.View<Backbone.Model>): void;
|
||||
function bindEntityEvents(target, entity, bindings);
|
||||
function unbindEntityEvents(target, entity, bindings);
|
||||
|
||||
@@ -121,24 +121,24 @@ declare module Marionette {
|
||||
close();
|
||||
}
|
||||
|
||||
class Region extends Backbone.Events {
|
||||
class Region<TModel extends Backbone.Model> extends Backbone.Events {
|
||||
|
||||
static buildRegion(regionConfig, defaultRegionType): Region;
|
||||
static buildRegion(regionConfig, defaultRegionType): Region<Backbone.Model>;
|
||||
|
||||
el: any;
|
||||
|
||||
show(view: Backbone.View): void;
|
||||
show(view: Backbone.View<TModel>): void;
|
||||
ensureEl(): void;
|
||||
open(view: Backbone.View): void;
|
||||
open(view: Backbone.View<TModel>): void;
|
||||
close(): void;
|
||||
attachView(view: Backbone.View);
|
||||
attachView(view: Backbone.View<TModel>);
|
||||
reset();
|
||||
}
|
||||
|
||||
class RegionManager extends Controller {
|
||||
class RegionManager<TModel extends Backbone.Model> extends Controller {
|
||||
addRegions(regionDefinitions, defaults?): any;
|
||||
addRegion(name, definition): Region;
|
||||
get (name: string): Region;
|
||||
addRegion(name, definition): Region<TModel>;
|
||||
get(name: string): Region<TModel>;
|
||||
removeRegion(name): void;
|
||||
removeRegions(): void;
|
||||
closeRegions(): void;
|
||||
@@ -146,33 +146,33 @@ declare module Marionette {
|
||||
|
||||
//mixins from Collection (copied from Backbone's Collection declaration)
|
||||
|
||||
all(iterator: (element: Region, index: number) => boolean, context?: any): boolean;
|
||||
any(iterator: (element: Region, index: number) => boolean, context?: any): boolean;
|
||||
all(iterator: (element: Region<TModel>, index: number) => boolean, context?: any): boolean;
|
||||
any(iterator: (element: Region<TModel>, index: number) => boolean, context?: any): boolean;
|
||||
contains(value: any): boolean;
|
||||
detect(iterator: (item: any) => boolean, context?: any): any;
|
||||
each(iterator: (element: Region, index: number, list?: any) => void , context?: any);
|
||||
every(iterator: (element: Region, index: number) => boolean, context?: any): boolean;
|
||||
filter(iterator: (element: Region, index: number) => boolean, context?: any): Region[];
|
||||
find(iterator: (element: Region, index: number) => boolean, context?: any): Region;
|
||||
first(): Region;
|
||||
forEach(iterator: (element: Region, index: number, list?: any) => void , context?: any);
|
||||
each(iterator: (element: Region<TModel>, index: number, list?: any) => void , context?: any);
|
||||
every(iterator: (element: Region<TModel>, index: number) => boolean, context?: any): boolean;
|
||||
filter(iterator: (element: Region<TModel>, index: number) => boolean, context?: any): Region<TModel>[];
|
||||
find(iterator: (element: Region<TModel>, index: number) => boolean, context?: any): Region<TModel>;
|
||||
first(): Region<TModel>;
|
||||
forEach(iterator: (element: Region<TModel>, index: number, list?: any) => void , context?: any);
|
||||
include(value: any): boolean;
|
||||
initial(): Region;
|
||||
initial(n: number): Region[];
|
||||
initial(): Region<TModel>;
|
||||
initial(n: number): Region<TModel>[];
|
||||
invoke(methodName: string, arguments?: any[]);
|
||||
isEmpty(object: any): boolean;
|
||||
last(): Region;
|
||||
last(n: number): Region[];
|
||||
lastIndexOf(element: Region, fromIndex?: number): number;
|
||||
map(iterator: (element: Region, index: number, context?: any) => any[], context?: any): any[];
|
||||
last(): Region<TModel>;
|
||||
last(n: number): Region<TModel>[];
|
||||
lastIndexOf(element: Region<TModel>, fromIndex?: number): number;
|
||||
map(iterator: (element: Region<TModel>, index: number, context?: any) => any[], context?: any): any[];
|
||||
pluck(attribute: string): any[];
|
||||
reject(iterator: (element: Region, index: number) => boolean, context?: any): Region[];
|
||||
rest(): Region;
|
||||
rest(n: number): Region[];
|
||||
reject(iterator: (element: Region<TModel>, index: number) => boolean, context?: any): Region<TModel>[];
|
||||
rest(): Region<TModel>;
|
||||
rest(n: number): Region<TModel>[];
|
||||
select(iterator: any, context?: any): any[];
|
||||
some(iterator: (element: Region, index: number) => boolean, context?: any): boolean;
|
||||
some(iterator: (element: Region<TModel>, index: number) => boolean, context?: any): boolean;
|
||||
toArray(): any[];
|
||||
without(...values: any[]): Region[];
|
||||
without(...values: any[]): Region<TModel>[];
|
||||
}
|
||||
|
||||
class TemplateCache {
|
||||
@@ -187,7 +187,7 @@ declare module Marionette {
|
||||
static render(template, data): void;
|
||||
}
|
||||
|
||||
class View extends Backbone.View {
|
||||
class View<TModel extends Backbone.Model> extends Backbone.View<TModel> {
|
||||
|
||||
constructor(options?: any);
|
||||
|
||||
@@ -208,72 +208,72 @@ declare module Marionette {
|
||||
triggerMethod(name, ...args: any[]): any;
|
||||
}
|
||||
|
||||
class ItemView extends View {
|
||||
class ItemView<TModel extends Backbone.Model> extends View<TModel> {
|
||||
|
||||
constructor(options?: any);
|
||||
|
||||
ui: any;
|
||||
|
||||
serializeData(): any;
|
||||
render(): ItemView;
|
||||
render(): ItemView<TModel>;
|
||||
close();
|
||||
}
|
||||
|
||||
class CollectionView extends View {
|
||||
class CollectionView<TModel extends Backbone.Model> extends View<TModel> {
|
||||
constructor(options?: any);
|
||||
|
||||
itemView: any;
|
||||
children: any;
|
||||
|
||||
//_initialEvents();
|
||||
addChildView(item: View, collection: View, options?: any);
|
||||
addChildView(item: View<TModel>, collection: View<TModel>, options?: any);
|
||||
onShowCalled();
|
||||
|
||||
triggerBeforeRender();
|
||||
triggerRendered();
|
||||
render(): CollectionView;
|
||||
render(): CollectionView<TModel>;
|
||||
|
||||
getItemView(item: any): ItemView;
|
||||
addItemView(item: any, ItemView: ItemView, index: Number);
|
||||
addChildViewEventForwarding(view: View);
|
||||
renderItemView(view: View, index: Number);
|
||||
getItemView(item: any): ItemView<TModel>;
|
||||
addItemView(item: any, ItemView: ItemView<TModel>, index: Number);
|
||||
addChildViewEventForwarding(view: View<TModel>);
|
||||
renderItemView(view: View<TModel>, index: Number);
|
||||
buildItemView(item: any, ItemViewType: any, itemViewOptions: any): any;
|
||||
removeItemView(item: any);
|
||||
removeChildView(view: View);
|
||||
removeChildView(view: View<TModel>);
|
||||
|
||||
checkEmpty();
|
||||
|
||||
appendHtml(collectionView: View, itemView: View, index: Number);
|
||||
appendHtml(collectionView: View<TModel>, itemView: View<TModel>, index: Number);
|
||||
|
||||
close();
|
||||
closeChildren();
|
||||
}
|
||||
|
||||
class CompositeView extends CollectionView {
|
||||
class CompositeView<TModel extends Backbone.Model> extends CollectionView<TModel> {
|
||||
|
||||
constructor(options?: any);
|
||||
|
||||
itemView: any;
|
||||
itemViewContainer: string;
|
||||
|
||||
render(): CompositeView;
|
||||
render(): CompositeView<TModel>;
|
||||
appendHtml(cv: any, iv: any);
|
||||
renderModel(): any;
|
||||
}
|
||||
|
||||
class Layout extends ItemView {
|
||||
class Layout<TModel extends Backbone.Model> extends ItemView<TModel> {
|
||||
|
||||
constructor(options?: any);
|
||||
|
||||
addRegion(name: string, definition: any): Region;
|
||||
addRegion(name: string, definition: any): Region<TModel>;
|
||||
addRegions(regions: any): any;
|
||||
render(): Layout;
|
||||
render(): Layout<TModel>;
|
||||
removeRegion(name: string);
|
||||
}
|
||||
|
||||
interface AppRouterOptions extends Backbone.RouterOptions {
|
||||
appRoutes: any;
|
||||
controller: any;
|
||||
appRoutes: any;
|
||||
controller: any;
|
||||
}
|
||||
|
||||
class AppRouter extends Backbone.Router {
|
||||
@@ -284,7 +284,7 @@ declare module Marionette {
|
||||
|
||||
}
|
||||
|
||||
class Application extends Backbone.Events {
|
||||
class Application<TModel extends Backbone.Model> extends Backbone.Events {
|
||||
|
||||
vent: Backbone.Wreqr.EventAggregator;
|
||||
commands: Backbone.Wreqr.Commands;
|
||||
@@ -297,15 +297,15 @@ declare module Marionette {
|
||||
start(options?);
|
||||
addRegions(regions);
|
||||
closeRegions(): void;
|
||||
removeRegion(region: Region);
|
||||
getRegion(regionName: string): Region;
|
||||
removeRegion(region: Region<TModel>);
|
||||
getRegion(regionName: string): Region<TModel>;
|
||||
module(moduleNames, moduleDefinition);
|
||||
}
|
||||
|
||||
// modules mapped for convenience, but you should probably use TypeScript modules instead
|
||||
class Module extends Backbone.Events {
|
||||
class Module<TModel extends Backbone.Model> extends Backbone.Events {
|
||||
|
||||
constructor(moduleName: string, app: Application);
|
||||
constructor(moduleName: string, app: Application<TModel>);
|
||||
|
||||
submodules: any;
|
||||
triggerMethod(name, ...args: any[]): any;
|
||||
@@ -319,7 +319,7 @@ declare module Marionette {
|
||||
}
|
||||
|
||||
declare module 'backbone.marionette' {
|
||||
import Backbone = require('backbone');
|
||||
|
||||
export = Marionette;
|
||||
import Backbone = require('backbone');
|
||||
|
||||
export = Marionette;
|
||||
}
|
||||
|
||||
Vendored
+8
-5
@@ -34,16 +34,19 @@ interface UUIDOptions {
|
||||
|
||||
interface UUID {
|
||||
v1(options?: UUIDOptions, buffer?: number[], offset?: number): string
|
||||
v1(options?: UUIDOptions, buffer?: NodeBuffer, offset?: number): string
|
||||
v1(options?: UUIDOptions, buffer?: Buffer, offset?: number): string
|
||||
|
||||
v2(options?: UUIDOptions, buffer?: number[], offset?: number): string
|
||||
v2(options?: UUIDOptions, buffer?: NodeBuffer, offset?: number): string
|
||||
v2(options?: UUIDOptions, buffer?: Buffer, offset?: number): string
|
||||
|
||||
v3(options?: UUIDOptions, buffer?: number[], offset?: number): string
|
||||
v3(options?: UUIDOptions, buffer?: NodeBuffer, offset?: number): string
|
||||
v3(options?: UUIDOptions, buffer?: Buffer, offset?: number): string
|
||||
|
||||
v4(options?: UUIDOptions, buffer?: number[], offset?: number): string
|
||||
v4(options?: UUIDOptions, buffer?: NodeBuffer, offset?: number): string
|
||||
v4(options?: UUIDOptions, buffer?: Buffer, offset?: number): string
|
||||
}
|
||||
|
||||
declare var uuid: UUID;
|
||||
declare module 'uuid' {
|
||||
var uuid: UUID;
|
||||
export = uuid;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
/// <reference path="node-uuid.d.ts" />
|
||||
|
||||
import uuid = require('node-uuid');
|
||||
|
||||
var uid1: string = uuid.v1()
|
||||
var uid2: string = uuid.v2()
|
||||
var uid3: string = uuid.v3()
|
||||
|
||||
@@ -0,0 +1,106 @@
|
||||
/// <reference path="tape.d.ts" />
|
||||
|
||||
/// <reference path="../node/node.d.ts" />
|
||||
|
||||
import tape = require('tape');
|
||||
|
||||
var x: any;
|
||||
var value: any;
|
||||
var err: any;
|
||||
var a: any;
|
||||
var b: any;
|
||||
var err: any;
|
||||
var num: number;
|
||||
var name: string;
|
||||
var msg: string;
|
||||
var rs: NodeJS.ReadableStream;
|
||||
|
||||
var cb: tape.TestCase;
|
||||
var t: tape.Test;
|
||||
|
||||
tape(name, cb);
|
||||
tape(name, (test: tape.Test) => {
|
||||
t = test;
|
||||
});
|
||||
|
||||
tape.skip(name, cb);
|
||||
tape.only(name, cb);
|
||||
|
||||
rs = tape.createStream();
|
||||
rs = tape.createStream(x);
|
||||
|
||||
var tx = tape.createHarness();
|
||||
tx(name, cb);
|
||||
tape.skip(name, cb);
|
||||
tape.only(name, cb);
|
||||
|
||||
tape(name, (test: tape.Test) => {
|
||||
|
||||
test.plan(num);
|
||||
test.end();
|
||||
|
||||
test.fail(msg);
|
||||
test.pass(msg);
|
||||
test.skip(msg);
|
||||
|
||||
test.ok(value, msg);
|
||||
test.true(value, msg);
|
||||
test.assert(value, msg);
|
||||
|
||||
test.notOk(value, msg);
|
||||
test.false(value, msg);
|
||||
test.notok(value, msg);
|
||||
|
||||
test.error(err, msg);
|
||||
test.ifError(err, msg);
|
||||
test.ifErr(err, msg);
|
||||
test.iferror(err, msg);
|
||||
|
||||
test.equal(a, b, msg);
|
||||
test.equals(a, b, msg);
|
||||
test.isEqual(a, b, msg);
|
||||
test.is(a, b, msg);
|
||||
test.strictEqual(a, b, msg);
|
||||
test.strictEquals(a, b, msg);
|
||||
|
||||
test.notEqual(a, b, msg);
|
||||
test.notEquals(a, b, msg);
|
||||
test.notStrictEqual(a, b, msg);
|
||||
test.notStrictEquals(a, b, msg);
|
||||
test.isNotEqual(a, b, msg);
|
||||
test.isNot(a, b, msg);
|
||||
test.not(a, b, msg);
|
||||
test.doesNotEqual(a, b, msg);
|
||||
test.notEqual(a, b, msg);
|
||||
test.isInequal(a, b, msg);
|
||||
|
||||
test.deepEqual(a, b, msg);
|
||||
test.deepEquals(a, b, msg);
|
||||
test.isEquivalent(a, b, msg);
|
||||
test.same(a, b, msg);
|
||||
|
||||
test.notDeepEqual(a, b, msg);
|
||||
test.notEquivalent(a, b, msg);
|
||||
test.notDeeply(a, b, msg);
|
||||
test.notSame(a, b, msg);
|
||||
test.isNotDeepEqual(a, b, msg);
|
||||
test.isNotDeeply(a, b, msg);
|
||||
test.isNotEquivalent(a, b, msg);
|
||||
test.isInequivalent(a, b, msg);
|
||||
|
||||
test.deepLooseEqual(a, b, msg);
|
||||
test.looseEqual(a, b, msg);
|
||||
test.looseEquals(a, b, msg);
|
||||
|
||||
test.notDeepLooseEqual(a, b, msg);
|
||||
test.notLooseEqual(a, b, msg);
|
||||
test.notLooseEquals(a, b, msg);
|
||||
|
||||
test.throws(() => {
|
||||
|
||||
}, value, msg);
|
||||
|
||||
test.doesNotThrow(() => {
|
||||
|
||||
}, value, msg);
|
||||
});
|
||||
Vendored
+161
@@ -0,0 +1,161 @@
|
||||
// Type definitions for tape v2.12.3
|
||||
// Project: https://github.com/substack/tape
|
||||
// Definitions by: Bart van der Schoor <https://github.com/Bartvds>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
/// <reference path="../node/node.d.ts" />
|
||||
|
||||
declare module 'tape' {
|
||||
export = tape;
|
||||
|
||||
/**
|
||||
* Create a new test with an optional name string. cb(t) fires with the new test object t once all preceeding tests have finished. Tests execute serially.
|
||||
*/
|
||||
function tape(name: string, cb: tape.TestCase): void;
|
||||
module tape {
|
||||
|
||||
interface TestCase {
|
||||
(test: Test): void;
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate a new test that will be skipped over.
|
||||
*/
|
||||
export function skip(name: string, cb: tape.TestCase): void;
|
||||
|
||||
/**
|
||||
* Like test(name, cb) except if you use .only this is the only test case that will run for the entire process, all other test cases using tape will be ignored
|
||||
*/
|
||||
export function only(name: string, cb: tape.TestCase): void;
|
||||
|
||||
/**
|
||||
* Create a new test harness instance, which is a function like test(), but with a new pending stack and test state.
|
||||
*/
|
||||
export function createHarness(): typeof tape;
|
||||
/**
|
||||
* Create a stream of output, bypassing the default output stream that writes messages to console.log().
|
||||
*/
|
||||
export function createStream(opts?: any): NodeJS.ReadableStream;
|
||||
|
||||
interface Test {
|
||||
/**
|
||||
* Create a subtest with a new test handle st from cb(st) inside the current test cb(st) will only fire when t finishes. Additional tests queued up after t will not be run until all subtests finish.
|
||||
*/
|
||||
test(name: string, cb: tape.TestCase): void;
|
||||
|
||||
/**
|
||||
* Declare that n assertions should be run. end() will be called automatically after the nth assertion. If there are any more assertions after the nth, or after end() is called, they will generate errors.
|
||||
*/
|
||||
plan(n: number): void;
|
||||
|
||||
/**
|
||||
* Declare the end of a test explicitly.
|
||||
*/
|
||||
end(): void;
|
||||
|
||||
/**
|
||||
* Generate a failing assertion with a message msg.
|
||||
*/
|
||||
fail(msg?: string): void;
|
||||
|
||||
/**
|
||||
* Generate a passing assertion with a message msg.
|
||||
*/
|
||||
pass(msg?: string): void;
|
||||
|
||||
/**
|
||||
* Generate an assertion that will be skipped over.
|
||||
*/
|
||||
skip(msg?: string): void;
|
||||
|
||||
/**
|
||||
* Assert that value is truthy with an optional description message msg.
|
||||
*/
|
||||
ok(value: any, msg?: string): void;
|
||||
true(value: any, msg?: string): void;
|
||||
assert(value: any, msg?: string): void;
|
||||
|
||||
/**
|
||||
* Assert that value is falsy with an optional description message msg.
|
||||
*/
|
||||
notOk(value: any, msg?: string): void;
|
||||
false(value: any, msg?: string): void;
|
||||
notok(value: any, msg?: string): void;
|
||||
|
||||
/**
|
||||
* Assert that err is falsy. If err is non-falsy, use its err.message as the description message.
|
||||
*/
|
||||
error(err: any, msg?: string): void;
|
||||
ifError(err: any, msg?: string): void;
|
||||
ifErr(err: any, msg?: string): void;
|
||||
iferror(err: any, msg?: string): void;
|
||||
|
||||
/**
|
||||
* Assert that a === b with an optional description msg.
|
||||
*/
|
||||
equal(a: any, b: any, msg?: string): void;
|
||||
equals(a: any, b: any, msg?: string): void;
|
||||
isEqual(a: any, b: any, msg?: string): void;
|
||||
is(a: any, b: any, msg?: string): void;
|
||||
strictEqual(a: any, b: any, msg?: string): void;
|
||||
strictEquals(a: any, b: any, msg?: string): void;
|
||||
|
||||
/**
|
||||
* Assert that a !== b with an optional description msg.
|
||||
*/
|
||||
notEqual(a: any, b: any, msg?: string): void;
|
||||
notEquals(a: any, b: any, msg?: string): void;
|
||||
notStrictEqual(a: any, b: any, msg?: string): void;
|
||||
notStrictEquals(a: any, b: any, msg?: string): void;
|
||||
isNotEqual(a: any, b: any, msg?: string): void;
|
||||
isNot(a: any, b: any, msg?: string): void;
|
||||
not(a: any, b: any, msg?: string): void;
|
||||
doesNotEqual(a: any, b: any, msg?: string): void;
|
||||
isInequal(a: any, b: any, msg?: string): void;
|
||||
|
||||
/**
|
||||
* Assert that a and b have the same structure and nested values using node's deepEqual() algorithm with strict comparisons (===) on leaf nodes and an optional description msg.
|
||||
*/
|
||||
deepEqual(a: any, b: any, msg?: string): void;
|
||||
deepEquals(a: any, b: any, msg?: string): void;
|
||||
isEquivalent(a: any, b: any, msg?: string): void;
|
||||
same(a: any, b: any, msg?: string): void;
|
||||
|
||||
/**
|
||||
* Assert that a and b do not have the same structure and nested values using node's deepEqual() algorithm with strict comparisons (===) on leaf nodes and an optional description msg.
|
||||
*/
|
||||
notDeepEqual(a: any, b: any, msg?: string): void;
|
||||
notEquivalent(a: any, b: any, msg?: string): void;
|
||||
notDeeply(a: any, b: any, msg?: string): void;
|
||||
notSame(a: any, b: any, msg?: string): void;
|
||||
isNotDeepEqual(a: any, b: any, msg?: string): void;
|
||||
isNotDeeply(a: any, b: any, msg?: string): void;
|
||||
isNotEquivalent(a: any, b: any, msg?: string): void;
|
||||
isInequivalent(a: any, b: any, msg?: string): void;
|
||||
|
||||
/**
|
||||
* Assert that a and b have the same structure and nested values using node's deepEqual() algorithm with loose comparisons (==) on leaf nodes and an optional description msg.
|
||||
*/
|
||||
deepLooseEqual(a: any, b: any, msg?: string): void;
|
||||
looseEqual(a: any, b: any, msg?: string): void;
|
||||
looseEquals(a: any, b: any, msg?: string): void;
|
||||
|
||||
/**
|
||||
* Assert that a and b do not have the same structure and nested values using node's deepEqual() algorithm with loose comparisons (==) on leaf nodes and an optional description msg.
|
||||
*/
|
||||
notDeepLooseEqual(a: any, b: any, msg?: string): void;
|
||||
notLooseEqual(a: any, b: any, msg?: string): void;
|
||||
notLooseEquals(a: any, b: any, msg?: string): void;
|
||||
|
||||
/**
|
||||
* Assert that the function call fn() throws an exception.
|
||||
*/
|
||||
throws(fn: () => void, expected: any, msg?: string): void;
|
||||
|
||||
/**
|
||||
* Assert that the function call fn() does not throw an exception.
|
||||
*/
|
||||
doesNotThrow(fn: () => void, expected: any, msg?: string): void;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
/// <reference path="tspromise.d.ts" />
|
||||
|
||||
import Promise = require('tspromise');
|
||||
|
||||
var MyFuncFunc = Promise.async((a: boolean, b: number) => {
|
||||
console.log('[a] ' + a);
|
||||
yield(Promise.waitAsync(1000));
|
||||
console.log('[b]' + b);
|
||||
});
|
||||
|
||||
MyFuncFunc(true, 10);
|
||||
|
||||
Promise.all([Promise.waitAsync(10), Promise.waitAsync(20)]).then(() => {
|
||||
return new Promise<String>((resolve, reject) => {
|
||||
resolve('test');
|
||||
});
|
||||
}).then(() => {
|
||||
throw (new Error());
|
||||
}).catch((e) => {
|
||||
console.log(e.message);
|
||||
});
|
||||
Vendored
+40
@@ -0,0 +1,40 @@
|
||||
// Type definitions for tspromise 0.0.4
|
||||
// Project: https://github.com/soywiz/tspromise
|
||||
// Definitions by: Carlos Ballesteros Velasco <https://github.com/soywiz>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
/// <reference path="../node/node.d.ts" />
|
||||
declare class Thenable<T> {
|
||||
then<TR>(onFulfilled: (value: T) => Thenable<TR>, onRejected?: (error: Error) => TR): Thenable<TR>;
|
||||
then<TR>(onFulfilled: (value: T) => Thenable<TR>, onRejected?: (error: Error) => void): Thenable<TR>;
|
||||
then<TR>(onFulfilled: (value: T) => TR, onRejected?: (error: Error) => void): Thenable<TR>;
|
||||
then<TR>(onFulfilled: (value: T) => TR, onRejected?: (error: Error) => TR): Thenable<TR>;
|
||||
catch(onRejected: (error: Error) => T): Thenable<T>;
|
||||
}
|
||||
|
||||
interface NodeCallback<T> {
|
||||
(err: Error, value: T): void;
|
||||
}
|
||||
|
||||
declare module "tspromise" {
|
||||
class Promise<T> extends Thenable<T> {
|
||||
constructor(callback: (resolve: (value?: T) => void, reject?: (error: Error) => void) => void);
|
||||
static resolve<T>(value?: T): Thenable<T>;
|
||||
static resolve<T>(promise: Thenable<T>): Thenable<T>;
|
||||
static reject<T>(error: Error): Thenable<T>;
|
||||
static all(promises: Thenable<any>[]): Thenable<any[]>;
|
||||
static async<TR>(callback: () => TR): () => Thenable<TR>;
|
||||
static async<T1, TR>(callback: (p1: T1) => TR): (p1: T1) => Thenable<TR>;
|
||||
static async<T1, T2, TR>(callback: (p1: T1, p2: T2) => TR): (p1: T1, p2: T2) => Thenable<TR>;
|
||||
static async<T1, T2, T3, TR>(callback: (p1: T1, p2: T2, p3: T3) => TR): (p1: T1, p2: T2, p3: T3) => Thenable<TR>;
|
||||
static async<T1, T2, T3, T4, TR>(callback: (p1: T1, p2: T2, p3: T3, p4: T4) => TR): (p1: T1, p2: T2, p3: T3, p4: T4) => Thenable<TR>;
|
||||
static spawn<TR>(generatorFunction: () => TR): Thenable<TR>;
|
||||
static rewriteFolderSync(path: string): void;
|
||||
static waitAsync(time: number): Thenable<{}>;
|
||||
static nfcall<T>(obj: any, methodName: String, ...args: any[]): Thenable<T>;
|
||||
}
|
||||
|
||||
export = Promise;
|
||||
}
|
||||
|
||||
declare function yield<T>(promise: Thenable<T>): T;
|
||||
Reference in New Issue
Block a user