mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-10-04 06:47:03 +00:00
Merge pull request #26100 from Schlaefer/feature/backboneMarionette-addGetUI
[backbone.marionette] adds View.getUI() and Behavior.getUI()
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
import * as JQuery from 'jquery';
|
||||
import * as Marionette from 'backbone.marionette';
|
||||
import * as Backbone from 'backbone';
|
||||
|
||||
@@ -9,6 +10,10 @@ class DestroyWarn extends Marionette.Behavior {
|
||||
message: 'you are destroying!'
|
||||
};
|
||||
|
||||
ui = {
|
||||
destroy: '.foo'
|
||||
};
|
||||
|
||||
// behaviors have events that are bound to the views DOM
|
||||
events = {
|
||||
'click @ui.destroy': 'warnBeforeDestroy'
|
||||
@@ -258,12 +263,18 @@ function RegionTests() {
|
||||
});
|
||||
}
|
||||
|
||||
function BehaviorTest() {
|
||||
const b = new DestroyWarn();
|
||||
const uiHandle: JQuery = b.getUI('destroy');
|
||||
}
|
||||
|
||||
function ViewTests() {
|
||||
const v = new MyView(new MyModel());
|
||||
const isDestroyed: boolean = v.isDestroyed();
|
||||
const isRendered: boolean = v.isRendered();
|
||||
const isAttached: boolean = v.isAttached();
|
||||
const vv: Marionette.View<Backbone.Model> = v.delegateEntityEvents();
|
||||
const uiHandle: JQuery = v.getUI('destroy');
|
||||
}
|
||||
|
||||
function CollectionViewTests() {
|
||||
|
||||
Vendored
+10
@@ -1143,6 +1143,11 @@ export class View<TModel extends Backbone.Model> extends Backbone.View<TModel> i
|
||||
* throughout the view with the ui attribute.
|
||||
*/
|
||||
ui: any;
|
||||
|
||||
/**
|
||||
* Get handle on UI element defined in ui hash
|
||||
*/
|
||||
getUI(ui: string): JQuery;
|
||||
}
|
||||
|
||||
export interface CollectionViewOptions<
|
||||
@@ -1561,6 +1566,11 @@ export class Behavior extends Object {
|
||||
*/
|
||||
ui: any;
|
||||
|
||||
/**
|
||||
* Get handle on UI element defined in ui hash
|
||||
*/
|
||||
getUI(ui: string): JQuery;
|
||||
|
||||
/**
|
||||
* Any triggers you define on the Behavior will be triggered in response to the appropriate event on the view.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user