MCPcopy Create free account
hub / github.com/PrairieLearn/PrairieLearn / eventsApi

Function eventsApi

public/javascripts/backbone.js:174–195  ·  view source on GitHub ↗
(obj, action, name, rest)

Source from the content-addressed store, hash-verified

172 // names `"change blur"` and jQuery-style event maps `{change: action}`
173 // in terms of the existing API.
174 var eventsApi = function(obj, action, name, rest) {
175 if (!name) return true;
176
177 // Handle event maps.
178 if (typeof name === 'object') {
179 for (var key in name) {
180 obj[action].apply(obj, [key, name[key]].concat(rest));
181 }
182 return false;
183 }
184
185 // Handle space separated event names.
186 if (eventSplitter.test(name)) {
187 var names = name.split(eventSplitter);
188 for (var i = 0, l = names.length; i < l; i++) {
189 obj[action].apply(obj, [names[i]].concat(rest));
190 }
191 return false;
192 }
193
194 return true;
195 };
196
197 // A difficult-to-believe, but optimized internal dispatch function for
198 // triggering events. Tries to keep the usual cases speedy (most internal

Callers 1

backbone.jsFile · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected