鍍金池/ 教程/ HTML/ BackboneJS事件
BackboneJS Collection.extend()方法
BackboneJS collection.pop()方法
BackboneJS collection.set()方法
BackboneJS collection.remove()方法
BackboneJS view.attributes
Backbone.View.extend()方法
BackboneJS router.route()方法
BackboneJS model.destroy()方法
BackboneJS視圖初始化
BackboneJS事件stopListening
BackboneJS collection.clone()方法
BackboneJS router.navigate()方法
BackboneJS model.idAttribute屬性
BackboneJS router.execute()方法
BackboneJS模型
BackboneJS model.previousAttributes()方法
BackboneJS model.escape()方法
BackboneJS model.previous()方法
BackboneJS應(yīng)用
BackboneJS view.setElement()方法
BackboneJS collection.findWhere()方法
BackboneJS collection.slice()方法
BackboneJS view.el
BackboneJS集合
BackboneJS model.unset()方法
BackboneJS collection.comparator屬性
BackboneJS collection.push()方法
BackboneJS model.save()方法
BackboneJS collection.shift()方法
BackboneJS collection.parse()方法
BackboneJS Collection.model
BackboneJS教程
BackboneJS model.defaults
BackboneJS事件trigger
BackboneJS collection.sync()方法
BackboneJS model.has()方法
BackboneJS model.isNew()方法
BackboneJS model.url()方法
BackboneJS Model.get()方法
BackboneJS視圖
BackboneJS model.clone()方法
BackboneJS collection.toJSON()方法
BackboneJS Backbone.emulateHTTP
BackboneJS Router初始化
BackboneJS環(huán)境設(shè)置
BackboneJS model.fetch()方法
BackboneJS事件
BackboneJS Model.set()方法
BackboneJS router.routes
BackboneJS collection.unshift()方法
BackboneJS collection.add()方法
BackboneJS collection.models
BackboneJS model.hasChanged()方法
BackboneJS collection.url()方法
BackboneJS Backbone.history.start()方法
BackboneJS model.validate()方法
BackboneJS collection.create()方法
BackboneJS model.parse()方法
BackboneJS事件on
BackboneJS collection.at()方法
BackboneJS事件off
BackboneJS view.$(selector)方法
BackboneJS .sync()方法
BackboneJS collection.sort()函數(shù)
BackboneJS collection.length
BackboneJS model.changedAttributes()方法
BackboneJS model.isValid()方法
BackboneJS model.attributes屬性
BackboneJS collection.reset()方法
BackboneJS model.validationError
BackboneJS model.clear()方法
BackboneJS collection.get(id)方法
BackboneJS model.changed
BackboneJS同步
BackboneJS 集合初始化
BackboneJS collection.fetch()方法
BackboneJS model.sync()方法
BackboneJS Model.extend()方法
BackboneJS model.id屬性
BackboneJS model.urlRoot()方法
BackboneJS路由
BackboneJS事件once
BackboneJS collection.pluck()方法
BackboneJS view.template(data)方法
BackboneJS事件listenTo
BackboneJS collection.where()方法
BackboneJS model.toJSON()方法
BackboneJS Backbone.emulateJSON
BackboneJS Model.initialize()方法
BackboneJS view.$el
BackboneJS事件listenToOnce
BackboneJS model.cid屬性

BackboneJS事件

事件能夠結(jié)合對象,并引發(fā)自定義事件即可以使用選擇的所需名稱綁定自定義事件。

下表列出了所有可以用它來操作BackboneJS-事件的方法:

S.N. 方法及說明
1 on
這一個(gè)事件綁定到一個(gè)對象,并執(zhí)行每當(dāng)一個(gè)事件被觸發(fā)回調(diào)。
2 off
它消除回調(diào)函數(shù)或來自對象的所有事件。
3 trigger
它調(diào)用回調(diào)函數(shù)對于給定的事件。
4 once
它擴(kuò)展backbone.Model類創(chuàng)建自己的backbone模型。
5 listenTo
它通知一個(gè)對象來監(jiān)聽另一個(gè)對象的事件。
6 stopListening
它可以用來停止監(jiān)聽到另一對象的事件。
7 listenToOnce
它會(huì)導(dǎo)致listenTo只發(fā)生在回調(diào)函數(shù)被刪除之前一次。

內(nèi)置事件的類別

BackboneJS允許使用應(yīng)用程序在必要的全局事件。它包含了一些與參數(shù)內(nèi)置事件下表所示:

S.N. 事件和說明
1 "add"(model, collection, options)
它用于當(dāng)模型被添加到集合
2 "remove"(model, collection, options)
它從集合中刪除模型
3 "reset"(collection, options)
它用于將復(fù)位集合內(nèi)容
4 "sort"(collection, options)
它是用來采集時(shí)需要重排序
5 "change"(model, options)
其用于當(dāng)在模型的屬性改變
6 "change:[attribute]"(model, value, options)
它用于當(dāng)在一個(gè)屬性的更新
7 "destroy"(model, collection, options)
它觸發(fā)模式時(shí)被銷毀
8 "request"(model_or_collection, xhr, options)
它用于模型或保藏開始請求到服務(wù)器
9 "sync"(model_or_collection, resp, options)
它是用來當(dāng)模型或收集與服務(wù)器成功同步
10 "error"(model_or_collection, resp, options)
它激活時(shí),在請求到服務(wù)器錯(cuò)誤
11 "invalid"(model, error, options)
當(dāng)在模型驗(yàn)證一個(gè)失敗,則返回?zé)o效
12 "route:[name]"(params)
當(dāng)有一個(gè)特定路由的匹配,該事件可以被使用
13 "route"(route,params)
它用于當(dāng)存在與任何路由匹配
14 "route"(router, route, params)
它使用歷史有一個(gè)與任何路由匹配
15 "all"
它激發(fā)了傳遞活動(dòng)的名稱作為第一個(gè)參數(shù)都觸發(fā)的事件。