@@ -271,7 +271,59 @@ var $AnimateProvider = ['$provide', function($provide) {
271
271
return {
272
272
// we don't call it directly since non-existant arguments may
273
273
// be interpreted as null within the sub enabled function
274
+
275
+ /**
276
+ *
277
+ * @ngdoc method
278
+ * @name $animate#on
279
+ * @kind function
280
+ * @description Sets up an event listener to fire whenever the animation event (enter, leave, move, etc...)
281
+ * has fired on the given element or among any of its children. Once the listener is fired, the provided callback
282
+ * is fired with the following params:
283
+ *
284
+ * ```js
285
+ * $animate.on('enter', container,
286
+ * function callback(element, phase) {
287
+ * // cool we detected an enter animation within the container
288
+ * }
289
+ * );
290
+ * ```
291
+ *
292
+ * @param {string } event the animation event that will be captured (e.g. enter, leave, move, addClass, removeClass, etc...)
293
+ * @param {DOMElement } container the container element that will capture each of the animation events that are fired on itself
294
+ * as well as among its children
295
+ * @param {Function } callback the callback function that will be fired when the listener is triggered
296
+ *
297
+ * The arguments present in the callback function are:
298
+ * * `element` - The captured DOM element that the animation was fired on.
299
+ * * `phase` - The phase of the animation. The two possible phases are **start** (when the animation starts) and **close** (when it ends).
300
+ */
274
301
on : $$animateQueue . on ,
302
+
303
+ /**
304
+ *
305
+ * @ngdoc method
306
+ * @name $animate#off
307
+ * @kind function
308
+ * @description Deregisters an event listener based on the event which has been associated with the provided element. This method
309
+ * can be used in three different ways depending on the arguments:
310
+ *
311
+ * ```js
312
+ * // remove all the animation event listeners listening for `enter`
313
+ * $animate.off('enter');
314
+ *
315
+ * // remove all the animation event listeners listening for `enter` on the given element and its children
316
+ * $animate.off('enter', container);
317
+ *
318
+ * // remove the event listener function provided by `listenerFn` that is set
319
+ * // to listen for `enter` on the given `element` as well as its children
320
+ * $animate.off('enter', container, callback);
321
+ * ```
322
+ *
323
+ * @param {string } event the animation event (e.g. enter, leave, move, addClass, removeClass, etc...)
324
+ * @param {DOMElement= } container the container element the event listener was placed on
325
+ * @param {Function= } callback the callback function that was registered as the listener
326
+ */
275
327
off : $$animateQueue . off ,
276
328
277
329
/**
@@ -292,10 +344,47 @@ var $AnimateProvider = ['$provide', function($provide) {
292
344
*/
293
345
pin : $$animateQueue . pin ,
294
346
347
+ /**
348
+ *
349
+ * @ngdoc method
350
+ * @name $animate#enabled
351
+ * @kind function
352
+ * @description Used to get and set whether animations are enabled or not on the entire application or on an element and its children. This
353
+ * function can be called in four ways:
354
+ *
355
+ * ```js
356
+ * // returns true or false
357
+ * $animate.enabled();
358
+ *
359
+ * // changes the enabled state for all animations
360
+ * $animate.enabled(false);
361
+ * $animate.enabled(true);
362
+ *
363
+ * // returns true or false if animations are enabled for an element
364
+ * $animate.enabled(element);
365
+ *
366
+ * // changes the enabled state for an element and its children
367
+ * $animate.enabled(element, true);
368
+ * $animate.enabled(element, false);
369
+ * ```
370
+ *
371
+ * @param {DOMElement= } element the element that will be considered for checking/setting the enabled state
372
+ * @param {boolean= } enabled whether or not the animations will be enabled for the element
373
+ *
374
+ * @return {boolean } whether or not animations are enabled
375
+ */
295
376
enabled : $$animateQueue . enabled ,
296
377
378
+ /**
379
+ * @ngdoc method
380
+ * @name $animate#cancel
381
+ * @kind function
382
+ * @description Cancels the provided animation.
383
+ *
384
+ * @param {Promise } animationPromise The animation promise that is returned when an animation is started.
385
+ */
297
386
cancel : function ( runner ) {
298
- runner . cancel && runner . end ( ) ;
387
+ runner . end && runner . end ( ) ;
299
388
} ,
300
389
301
390
/**
0 commit comments