Merge pull request #32909 from jgonggrijp/backbone-events-interface

Fix Events interface in backbone, backbone-relational, backbone.radio, backbone.marionette and giraffe
This commit is contained in:
Mine Starks
2019-02-15 08:22:44 -08:00
committed by GitHub
10 changed files with 290 additions and 314 deletions
+1 -1
View File
@@ -1,5 +1,5 @@
// Type definitions for Backbone-associations 0.6.4
// Project: https://github.com/dhruvaray/backbone-associations/
// Project: http://dhruvaray.github.io/backbone-associations
// Definitions by: Craig Brett <https://github.com/craigbrett17>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3
+120 -137
View File
@@ -7,180 +7,163 @@
/// <reference types="jquery" />
import { Events, EventsHash, Model as BModel, Collection } from 'backbone';
import { EventsMixin, Events, Model as BModel, Collection } from 'backbone';
declare module 'backbone-relational' {
class Model extends BModel {
/**
* Do not use, prefer TypeScript's extend functionality.
**/
//private static extend(properties:any, classProperties?:any):any;
export class Model extends BModel {
/**
* Do not use, prefer TypeScript's extend functionality.
**/
//private static extend(properties:any, classProperties?:any):any;
relations:any;
subModelTypes:any;
subModelTypeAttribute:any;
relations:any;
subModelTypes:any;
subModelTypeAttribute:any;
initializeRelations(options:any):void;
initializeRelations(options:any):void;
updateRelations(options:any):void;
updateRelations(options:any):void;
queue(func:any):void;
queue(func:any):void;
processQueue():void;
processQueue():void;
getRelation(name:string):Relation;
getRelation(name:string):Relation;
getRelations():Relation[];
getRelations():Relation[];
fetchRelated(key:string, options?:any, update?:boolean):any;
fetchRelated(key:string, options?:any, update?:boolean):any;
toJSON(options?: any):any;
toJSON(options?: any):any;
static setup();
static setup();
static build(attributes:any, options?:any);
static build(attributes:any, options?:any);
static findOrCreate(attributes:string, options?:any);
static findOrCreate(attributes:string, options?:any);
static findOrCreate(attributes:number, options?:any);
static findOrCreate(attributes:number, options?:any);
static findOrCreate(attributes:any, options?:any);
}
static findOrCreate(attributes:any, options?:any);
}
export class Relation extends BModel {
export class Relation extends BModel {
options:any;
instance:any;
key:any;
keyContents:any;
relatedModel:any;
relatedCollection:any;
reverseRelation:any;
related:any;
options:any;
instance:any;
key:any;
keyContents:any;
relatedModel:any;
relatedCollection:any;
reverseRelation:any;
related:any;
checkPreconditions():boolean;
checkPreconditions():boolean;
setRelated(related:BModel):void;
setRelated(related:BModel):void;
setRelated(related:Collection<BModel>):void;
setRelated(related:Collection<BModel>):void;
getReverseRelations(model:Model):Relation;
getReverseRelations(model:Model):Relation;
destroy():void;
}
destroy():void;
}
export class HasOne extends Relation {
collectionType:any;
export class HasOne extends Relation {
collectionType:any;
findRelated(options:any):BModel;
findRelated(options:any):BModel;
setKeyContents(keyContents:string):void;
setKeyContents(keyContents:string):void;
setKeyContents(keyContents:string[]):void;
setKeyContents(keyContents:string[]):void;
setKeyContents(keyContents:number):void;
setKeyContents(keyContents:number):void;
setKeyContents(keyContents:number[]):void;
setKeyContents(keyContents:number[]):void;
setKeyContents(keyContents:Collection<BModel>):void;
setKeyContents(keyContents:Collection<BModel>):void;
onChange(model:BModel, attr:any, options:any):void;
onChange(model:BModel, attr:any, options:any):void;
handleAddition(model:BModel, coll:Collection<BModel>, options:any):void;
handleAddition(model:BModel, coll:Collection<BModel>, options:any):void;
handleRemoval(model:BModel, coll:Collection<BModel>, options:any):void;
handleRemoval(model:BModel, coll:Collection<BModel>, options:any):void;
handleReset(coll:Collection<BModel>, options:any):void;
handleReset(coll:Collection<BModel>, options:any):void;
tryAddRelated(model:BModel, coll:any, options:any):void;
tryAddRelated(model:BModel, coll:any, options:any):void;
addRelated(model:BModel, options:any):void;
addRelated(model:BModel, options:any):void;
removeRelated(model:BModel, coll:any, options:any):void;
}
export class HasMany extends Relation {
collectionType:any;
findRelated(options:any):BModel;
setKeyContents(keyContents:string):void;
setKeyContents(keyContents:number):void;
setKeyContents(keyContents:BModel):void;
onChange(model:BModel, attr:any, options:any):void;
tryAddRelated(model:BModel, coll:any, options:any):void;
addRelated(model:BModel, options:any):void;
removeRelated(model:BModel, coll:any, options:any):void;
}
export class Store implements Events {
on(eventName: string, callback?: (...args: any[]) => void, context?: any): any;
on(eventMap: EventsHash): any;
on(eventName: any, callback?: any, 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;
initializeRelation(model, relation, options);
addModelScope(scope:any):void;
removeModelScope(scope):void;
addSubModels(subModelTypes:Model, superModelType:Model):void;
setupSuperModel(modelType:Model):void;
addReverseRelation(relation:any):void;
addOrphanRelation(relation:any):void;
processOrphanRelations():void;
retroFitRelation(relation:Model, create:boolean):Collection<BModel>;
getCollection(type:Model, create:boolean):Collection<BModel>;
getObjectByName(name:string):any;
resolveIdForItem(type:any, item:any):any;
static find(type:any, item:string):Model;
static find(type:any, item:number):Model;
static find(type:any, item:Model):Model;
static find(type:any, item:any):Model;
register(model:Model):void;
checkId(model:Model, id:any):void;
update(model:Model):void;
unregister(model:Model, collection:Collection<BModel>, options:any):void;
reset():void;
}
removeRelated(model:BModel, coll:any, options:any):void;
}
export class HasMany extends Relation {
collectionType:any;
findRelated(options:any):BModel;
setKeyContents(keyContents:string):void;
setKeyContents(keyContents:number):void;
setKeyContents(keyContents:BModel):void;
onChange(model:BModel, attr:any, options:any):void;
tryAddRelated(model:BModel, coll:any, options:any):void;
addRelated(model:BModel, options:any):void;
removeRelated(model:BModel, coll:any, options:any):void;
}
export class Store extends EventsMixin implements Events {
initializeRelation(model, relation, options);
addModelScope(scope:any):void;
removeModelScope(scope):void;
addSubModels(subModelTypes:Model, superModelType:Model):void;
setupSuperModel(modelType:Model):void;
addReverseRelation(relation:any):void;
addOrphanRelation(relation:any):void;
processOrphanRelations():void;
retroFitRelation(relation:Model, create:boolean):Collection<BModel>;
getCollection(type:Model, create:boolean):Collection<BModel>;
getObjectByName(name:string):any;
resolveIdForItem(type:any, item:any):any;
static find(type:any, item:string):Model;
static find(type:any, item:number):Model;
static find(type:any, item:Model):Model;
static find(type:any, item:any):Model;
register(model:Model):void;
checkId(model:Model, id:any):void;
update(model:Model):void;
unregister(model:Model, collection:Collection<BModel>, options:any):void;
reset():void;
}
-55
View File
@@ -1,79 +1,24 @@
{
"extends": "dtslint/dt.json",
"rules": {
"adjacent-overload-signatures": false,
"array-type": false,
"arrow-return-shorthand": false,
"ban-types": false,
"callable-types": false,
"comment-format": false,
"dt-header": false,
"eofline": false,
"export-just-namespace": false,
"import-spacing": false,
"interface-name": false,
"interface-over-type-literal": false,
"jsdoc-format": false,
"max-line-length": false,
"member-access": false,
"new-parens": false,
"no-any-union": false,
"no-boolean-literal-compare": false,
"no-conditional-assignment": false,
"no-consecutive-blank-lines": false,
"no-construct": false,
"no-declare-current-package": false,
"no-duplicate-imports": false,
"no-duplicate-variable": false,
"no-empty-interface": false,
"no-for-in-array": false,
"no-inferrable-types": false,
"no-internal-module": false,
"no-irregular-whitespace": false,
"no-mergeable-namespace": false,
"no-misused-new": false,
"no-namespace": false,
"no-object-literal-type-assertion": false,
"no-padding": false,
"no-redundant-jsdoc": false,
"no-redundant-jsdoc-2": false,
"no-redundant-undefined": false,
"no-reference-import": false,
"no-relative-import-in-test": false,
"no-self-import": false,
"no-single-declare-module": false,
"no-string-throw": false,
"no-unnecessary-callback-wrapper": false,
"no-unnecessary-class": false,
"no-unnecessary-generics": false,
"no-unnecessary-qualifier": false,
"no-unnecessary-type-assertion": false,
"no-useless-files": false,
"no-var-keyword": false,
"no-var-requires": false,
"no-void-expression": false,
"no-trailing-whitespace": false,
"object-literal-key-quotes": false,
"object-literal-shorthand": false,
"one-line": false,
"one-variable-per-declaration": false,
"only-arrow-functions": false,
"prefer-conditional-expression": false,
"prefer-const": false,
"prefer-declare-function": false,
"prefer-for-of": false,
"prefer-method-signature": false,
"prefer-template": false,
"radix": false,
"semicolon": false,
"space-before-function-paren": false,
"space-within-parens": false,
"strict-export-declare-modifiers": false,
"trim-file": false,
"triple-equals": false,
"typedef-whitespace": false,
"unified-signatures": false,
"void-return": false,
"whitespace": false
}
}
+6 -11
View File
@@ -6,6 +6,7 @@
// Volker Nauruhn <https://github.com/razorness>,
// Ard Timmerman <https://github.com/confususs>,
// J. Joe Koullas <https://github.com/jjoekoullas>
// Julian Gonggrijp <https://github.com/jgonggrijp>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3
@@ -407,20 +408,14 @@ export interface ObjectOptions extends RadioMixinOptions {
* A base class which other classes can extend from. Object incorporates many
* backbone conventions and utilities like initialize and Backbone.Events.
*/
export class Object implements CommonMixin, RadioMixin, Backbone.Events {
export class Object extends Backbone.EventsMixin implements CommonMixin, RadioMixin, Backbone.Events {
constructor(options?: ObjectOptions);
on(eventName: string, callback?: (...args: any[]) => void, context?: any): any;
on(eventMap: EventsHash): any;
/**
* Faulty overgeneralization of Backbone.Events.on, for historical
* reasons.
*/
on(eventName: any, callback?: any, 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;
/**
* Receives a hash of event names and functions and/or function names,
+6 -11
View File
@@ -1,6 +1,7 @@
// Type definitions for Backbone.Radio v0.8.3
// Project: https://github.com/marionettejs/backbone.radio
// Definitions by: Peter Palotas <https://github.com/alphaleonis>
// Julian Gonggrijp <https://github.com/jgonggrijp>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3
@@ -71,18 +72,12 @@ declare module "backbone" {
stopReplying(commandName?: string, callback?: (...args: any[]) => any, context?: any): Requests;
}
class Channel implements Commands, Requests, Backbone.Events {
on(eventName: string, callback?: (...args: any[]) => void, context?: any): any;
on(eventMap: EventsHash): any;
class Channel extends Backbone.EventsMixin implements Commands, Requests, Backbone.Events {
/**
* Faulty overgeneralization of Backbone.Events.on, for historical
* reasons.
*/
on(eventName: any, callback?: any, 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;
channelName: string;
reset(): Channel;
+49 -1
View File
@@ -15,6 +15,50 @@ function test_events() {
object.off();
}
class PubSub implements Backbone.Events {
on: Backbone.Events_On<PubSub>;
off: Backbone.Events_Off<PubSub>;
trigger: Backbone.Events_Trigger<PubSub>;
bind: Backbone.Events_On<PubSub>;
unbind: Backbone.Events_Off<PubSub>;
once: Backbone.Events_On<PubSub>;
listenTo: Backbone.Events_Listen<PubSub>;
listenToOnce: Backbone.Events_Listen<PubSub>;
stopListening: Backbone.Events_Stop<PubSub>;
}
Object.assign(PubSub.prototype, Backbone.Events);
function test_events_shorthands() {
let channel1 = new PubSub();
let channel2 = new PubSub();
let onChange = () => alert('whatever');
channel1.on("alert", (eventName: string) => alert("Triggered " + eventName));
channel1.trigger("alert", "an event");
channel1.once('invalid', () => { }, this);
channel1.once('invalid', () => { });
channel1.once({invalid: () => { }, success: () => { }}, this);
channel1.once({invalid: () => { }, success: () => { }});
channel1.off("change", onChange);
channel1.off("change");
channel1.off(null, onChange);
channel1.off(null, null, this);
channel1.off();
channel2.listenTo(channel1, 'invalid', () => { });
channel2.listenTo(channel1, {invalid: () => { }, success: () => { }});
channel2.listenToOnce(channel1, 'invalid', () => { });
channel2.listenToOnce(channel1, {invalid: () => { }, success: () => { }});
channel2.stopListening(channel1, 'invalid', () => { });
channel2.stopListening(channel1, 'invalid');
channel2.stopListening(channel1);
}
class SettingDefaults extends Backbone.Model {
// 'defaults' could be set in one of the following ways:
@@ -272,18 +316,22 @@ namespace v1Changes {
var model = new Employee;
model.once('invalid', () => { }, this);
model.once('invalid', () => { });
model.once({invalid: () => { }, success: () => { }}, this);
model.once({invalid: () => { }, success: () => { }});
}
function test_listenTo() {
var model = new Employee;
var view = new Backbone.View<Employee>();
view.listenTo(model, 'invalid', () => { });
view.listenTo(model, {invalid: () => { }, success: () => { }});
}
function test_listenToOnce() {
var model = new Employee;
var view = new Backbone.View<Employee>();
view.listenToOnce(model, 'invalid', () => { });
view.listenToOnce(model, {invalid: () => { }, success: () => { }});
}
function test_stopListening() {
@@ -398,7 +446,7 @@ namespace v1Changes {
namespace Collection {
function test_fetch() {
var collection = new EmployeeCollection;
collection.fetch({
collection.fetch({
reset: true,
remove: false
});
+101 -48
View File
@@ -1,9 +1,11 @@
// Type definitions for Backbone 1.3.3
// Project: http://backbonejs.org/
// https://github.com/jashkenas/backbone
// Definitions by: Boris Yankov <https://github.com/borisyankov>
// Natan Vivo <https://github.com/nvivo>
// kenjiru <https://github.com/kenjiru>
// jjoekoullas <https://github.com/jjoekoullas>
// Julian Gonggrijp <https://github.com/jgonggrijp>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3
@@ -91,44 +93,113 @@ declare namespace Backbone {
[routePattern: string]: string | {(...urlParts: string[]): void};
}
/**
* DOM events (used in the events property of a View)
*/
interface EventsHash {
[selector: string]: string | {(eventObject: JQuery.TriggeredEvent): void};
}
export const Events: Events;
interface Events {
on(eventName: string, callback?: (...args: any[]) => void, context?: any): any;
on(eventMap: EventsHash): 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;
/**
* JavaScript events (used in the methods of the Events interface)
*/
interface EventHandler {
(...args: any[]): void;
}
interface EventMap {
[event: string]: EventHandler;
}
class ModelBase implements Events {
on(eventName: string, callback?: Function, context?: any): any;
on(eventMap: EventsHash): any;
on(eventName: any, callback?: any, 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
unbind(eventName?: string, callback?: Function, context?: any): any
once(events: string, callback: Function, context?: any): any
listenTo(object: any, events: string, callback: Function):any
listenToOnce(object: any, events: string, callback: Function): any
stopListening(object?: any, events?: string, callback?: Function): any
export const Events: Events;
interface Events extends EventsMixin { }
/**
* Helper shorthands for classes that implement the Events interface.
* Define your class like this:
*
* import {
* Events,
* Events_On,
* Events_Off,
* Events_Trigger,
* Events_Listen,
* Events_Stop,
* } from 'backbone';
*
* class YourClass implements Events {
* on: Events_On<YourClass>;
* off: Events_Off<YourClass>;
* trigger: Events_Trigger<YourClass>;
* bind: Events_On<YourClass>;
* unbind: Events_Off<YourClass>;
*
* once: Events_On<YourClass>;
* listenTo: Events_Listen<YourClass>;
* listenToOnce: Events_Listen<YourClass>;
* stopListening: Events_Stop<YourClass>;
*
* // ... (other methods)
* }
*
* Object.assign(YourClass.prototype, Events); // can also use _.extend
*
* If you are just writing a class type declaration that doesn't already
* extend some other base class, you can use the EventsMixin instead;
* see below.
*/
interface Events_On<BaseT> {
<T extends BaseT>(this: T, eventName: string, callback: EventHandler, context?: any): T;
<T extends BaseT>(this: T, eventMap: EventMap, context?: any): T;
}
interface Events_Off<BaseT> {
<T extends BaseT>(this: T, eventName?: string, callback?: EventHandler, context?: any): T;
}
interface Events_Trigger<BaseT> {
<T extends BaseT>(this: T, eventName: string, ...args: any[]): T;
}
interface Events_Listen<BaseT> {
<T extends BaseT>(this: T, object: any, events: string, callback: EventHandler): T;
<T extends BaseT>(this: T, object: any, eventMap: EventMap): T;
}
interface Events_Stop<BaseT> {
<T extends BaseT>(this: T, object?: any, events?: string, callback?: EventHandler): T;
}
/**
* Helper to avoid code repetition in type declarations.
* Backbone.Events cannot be extended, hence a separate abstract
* class with a different name. Both classes and interfaces can
* extend from this helper class to reuse the signatures.
*
* For class type declarations that already extend another base
* class, and for actual class definitions, please see the
* Events_* interfaces above.
*/
abstract class EventsMixin implements Events {
on(eventName: string, callback: EventHandler, context?: any): this;
on(eventMap: EventMap, context?: any): this;
off(eventName?: string, callback?: EventHandler, context?: any): this;
trigger(eventName: string, ...args: any[]): this;
bind(eventName: string, callback: EventHandler, context?: any): this;
bind(eventMap: EventMap, context?: any): this;
unbind(eventName?: string, callback?: EventHandler, context?: any): this;
once(events: string, callback: EventHandler, context?: any): this;
once(eventMap: EventMap, context?: any): this;
listenTo(object: any, events: string, callback: EventHandler): this;
listenTo(object: any, eventMap: EventMap): this;
listenToOnce(object: any, events: string, callback: EventHandler): this;
listenToOnce(object: any, eventMap: EventMap): this;
stopListening(object?: any, events?: string, callback?: EventHandler): this;
}
class ModelBase extends EventsMixin {
parse(response: any, options?: any): any;
toJSON(options?: any): any;
sync(...arg: any[]): JQueryXHR;
}
class Model extends ModelBase {
class Model extends ModelBase implements Events {
/**
* Do not use, prefer TypeScript's extend functionality.
@@ -229,7 +300,7 @@ declare namespace Backbone {
matches(attrs: any): boolean;
}
class Collection<TModel extends Model> extends ModelBase {
class Collection<TModel extends Model> extends ModelBase implements Events {
/**
* Do not use, prefer TypeScript's extend functionality.
@@ -367,7 +438,7 @@ declare namespace Backbone {
without(...values: TModel[]): TModel[];
}
class Router extends EventSignatures {
class Router extends EventsMixin implements Events {
/**
* Do not use, prefer TypeScript's extend functionality.
@@ -396,7 +467,7 @@ declare namespace Backbone {
var history: History;
class History extends EventSignatures {
class History extends EventsMixin implements Events {
handlers: any[];
interval: number;
@@ -433,7 +504,7 @@ declare namespace Backbone {
attributes?: {[id: string]: any};
}
class View<TModel extends Model> extends EventSignatures {
class View<TModel extends Model> extends EventsMixin implements Events {
/**
* Do not use, prefer TypeScript's extend functionality.
@@ -485,21 +556,3 @@ declare namespace Backbone {
function noConflict(): typeof Backbone;
var $: JQueryStatic;
}
/**
* This is not for external use and is only here as a convenient way to
* specify signatures for internal implementers of Backbone.Events
*/
declare abstract class EventSignatures implements Backbone.Events {
on(eventName: string, callback?: (...args: any[]) => void, context?: any): any;
on(eventMap: Backbone.EventsHash): 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;
}
-38
View File
@@ -8,73 +8,35 @@
"callable-types": false,
"comment-format": false,
"dt-header": false,
"eofline": false,
"export-just-namespace": false,
"import-spacing": false,
"interface-name": false,
"interface-over-type-literal": false,
"jsdoc-format": false,
"max-line-length": false,
"member-access": false,
"new-parens": false,
"no-angle-bracket-type-assertion": false,
"no-any-union": false,
"no-boolean-literal-compare": false,
"no-conditional-assignment": false,
"no-consecutive-blank-lines": false,
"no-construct": false,
"no-declare-current-package": false,
"no-duplicate-imports": false,
"no-duplicate-variable": false,
"no-empty-interface": false,
"no-for-in-array": false,
"no-inferrable-types": false,
"no-internal-module": false,
"no-irregular-whitespace": false,
"no-mergeable-namespace": false,
"no-misused-new": false,
"no-namespace": false,
"no-object-literal-type-assertion": false,
"no-padding": false,
"no-redundant-jsdoc": false,
"no-redundant-jsdoc-2": false,
"no-redundant-undefined": false,
"no-reference-import": false,
"no-relative-import-in-test": false,
"no-self-import": false,
"no-single-declare-module": false,
"no-string-throw": false,
"no-unnecessary-callback-wrapper": false,
"no-unnecessary-class": false,
"no-unnecessary-generics": false,
"no-unnecessary-qualifier": false,
"no-unnecessary-type-assertion": false,
"no-useless-files": false,
"no-var-keyword": false,
"no-var-requires": false,
"no-void-expression": false,
"no-trailing-whitespace": false,
"object-literal-key-quotes": false,
"object-literal-shorthand": false,
"one-line": false,
"one-variable-per-declaration": false,
"only-arrow-functions": false,
"prefer-conditional-expression": false,
"prefer-const": false,
"prefer-declare-function": false,
"prefer-for-of": false,
"prefer-method-signature": false,
"prefer-template": false,
"radix": false,
"semicolon": false,
"space-before-function-paren": false,
"space-within-parens": false,
"strict-export-declare-modifiers": false,
"trim-file": false,
"triple-equals": false,
"typedef-whitespace": false,
"unified-signatures": false,
"void-return": false,
"whitespace": false
}
}
+6 -11
View File
@@ -1,6 +1,7 @@
// Type definitions for Giraffe
// Project: https://github.com/barc/backbone.giraffe
// Definitions by: Matt McCray <https://github.com/darthapo>
// Julian Gonggrijp <https://github.com/jgonggrijp>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3
@@ -145,18 +146,12 @@ declare namespace Giraffe {
namespace Contrib {
class Controller implements GiraffeObject, Backbone.Events {
on(eventName: string, callback?: (...args: any[]) => void, context?: any);
on(eventMap: Backbone.EventsHash);
class Controller extends Backbone.EventsMixin implements GiraffeObject, Backbone.Events {
/**
* Faulty overgeneralization of Backbone.Events.on, for historical
* reasons.
*/
on(eventName: any, callback?: any, context?: any)
off(eventName?: string, callback?: (...args: any[]) => void, context?: any)
trigger(eventName: string, ...args: any[])
bind(eventName: string, callback: (...args: any[]) => void, context?: any)
unbind(eventName?: string, callback?: (...args: any[]) => void, context?: 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;
app: App;
}
+1 -1
View File
@@ -1,5 +1,5 @@
// Type definitions for Knockback.js
// Project: http://kmalakoff.github.io/knockback/
// Project: http://kmalakoff.github.com/knockback
// Definitions by: Boris Yankov <https://github.com/borisyankov>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3