mirror of
https://github.com/wassname/DefinitelyTyped.git
synced 2026-09-09 11:13:57 +08:00
Added Marionette.Behavior and Marionette.Behaviors classes (new in Marionette 2.XX).
Modified ui property to not neccessarily be a function (it can also be a hash).
This commit is contained in:
Vendored
+85
-1
@@ -666,6 +666,11 @@ declare module Marionette {
|
||||
|
||||
constructor(options?: Backbone.ViewOptions<TModel>);
|
||||
|
||||
/**
|
||||
* Defines behaviors attached to this view.
|
||||
*/
|
||||
behaviors: any;
|
||||
|
||||
/**
|
||||
* A configuration hash for models. The left side is the event on
|
||||
* the model, and the right side is the name of the
|
||||
@@ -692,7 +697,7 @@ declare module Marionette {
|
||||
* jQuery selector. Afterwards you can simply access it via
|
||||
* this.ui.elementName.
|
||||
*/
|
||||
ui(): any;
|
||||
ui: any;
|
||||
|
||||
/**
|
||||
* There may be some cases where you need to change the template that is
|
||||
@@ -1255,6 +1260,85 @@ declare module Marionette {
|
||||
stopvoid;
|
||||
addDefinition(moduleDefinition, customArgs);
|
||||
}
|
||||
|
||||
/**
|
||||
* A Behavior is an isolated set of DOM / user interactions that can be mixed
|
||||
* into any View or another Behavior. Behaviors allow you to blackbox View
|
||||
* specific interactions into portable logical chunks, keeping your views
|
||||
* simple and your code DRY.
|
||||
*/
|
||||
class Behavior extends Marionette.Object {
|
||||
constructor(options?: any, view?: any);
|
||||
|
||||
options: any;
|
||||
|
||||
/**
|
||||
* Any triggers you define on the Behavior will be triggered in response to the appropriate event on the view.
|
||||
*/
|
||||
triggers: any;
|
||||
|
||||
/**
|
||||
* modelEvents will respond to the view's model events.
|
||||
*/
|
||||
modelEvents: any;
|
||||
|
||||
/**
|
||||
* collectionEvents will respond to the view's collection events.
|
||||
*/
|
||||
collectionEvents: any;
|
||||
|
||||
/**
|
||||
* The behaviors key allows a behavior to group multiple behaviors
|
||||
* together.
|
||||
*/
|
||||
behaviors: any;
|
||||
|
||||
/**
|
||||
* defaults can be a hash or function to define the default options for
|
||||
* your behavior. The default options will be overridden depending on
|
||||
* what you set as the options per behavior (this works just like a
|
||||
* backbone.model).
|
||||
*/
|
||||
defaults: any;
|
||||
|
||||
/**
|
||||
* el is a direct proxy of the view's el
|
||||
*/
|
||||
el: any;
|
||||
|
||||
/**
|
||||
* $el is a direct proxy of the view's el cached as a jQuery selector.
|
||||
*/
|
||||
$el: JQuery;
|
||||
|
||||
/** A reference to the view instance that the behavior is on. */
|
||||
view: any;
|
||||
|
||||
/**
|
||||
* $ is a direct proxy of the views $ lookup method.
|
||||
*/
|
||||
$(selector: any): JQuery;
|
||||
}
|
||||
|
||||
/**
|
||||
* Marionette.Behaviors' is a utility class that takes care of glueing your
|
||||
* behavior instances to their given View. The most important part of this
|
||||
* class is that you MUST override the class level behaviorsLookup method or
|
||||
* set the option behaviorClass for things to work properly.
|
||||
*/
|
||||
class Behaviors {
|
||||
/**
|
||||
* This method defines where your behavior classes are stored. Override this to provide another lookup.
|
||||
*/
|
||||
static behaviorsLookup(): any;
|
||||
|
||||
/**
|
||||
* This method has a default implementation that is simple to override. It
|
||||
* is responsible for the lookup of single behavior from within the
|
||||
* Behaviors.behaviorsLookup or elsewhere.
|
||||
*/
|
||||
static getBehaviorClass(options: any, key: string): Behavior;
|
||||
}
|
||||
}
|
||||
|
||||
declare module 'backbone.marionette' {
|
||||
|
||||
Reference in New Issue
Block a user