]> git.ipfire.org Git - thirdparty/foundation/foundation-sites.git/commitdiff
Fix autodoc for abide and accordion feature/fix-autodoc-for-js
authorKevin Ball <kmball11@gmail.com>
Wed, 28 Jun 2017 22:47:16 +0000 (15:47 -0700)
committerKevin Ball <kmball11@gmail.com>
Wed, 28 Jun 2017 22:47:16 +0000 (15:47 -0700)
js/foundation.abide.js
js/foundation.accordion.js

index a2609c6f56f6daee619f770c7321faccdb9d0ef8..cbfe993c9047daa9411bf775210be3450ad9793b 100644 (file)
@@ -12,10 +12,15 @@ class Abide extends Plugin {
   /**
    * Creates a new instance of Abide.
    * @class
-   * @fires Abide#init
    * @param {Object} element - jQuery object to add the trigger to.
    * @param {Object} options - Overrides to the default plugin settings.
    */
+  constructor(element, options = {}) { super(element, options); }
+
+  /**
+   * Fires when the plugin has initialized
+   * @event Abide#init
+   */
   _setup(element, options = {}) {
     this.$element = element;
     this.options  = $.extend({}, Abide.defaults, this.$element.data(), options);
@@ -449,6 +454,10 @@ class Abide extends Plugin {
     $form.trigger('formreset.zf.abide', [$form]);
   }
 
+  /**
+   * Fires when the plugin has been destroyed.
+   * @event Abide#destroyed
+   */
   /**
    * Destroys an instance of Abide.
    * Removes error styles and classes from elements, without resetting their values.
@@ -466,6 +475,11 @@ class Abide extends Plugin {
         _this.removeErrorClasses($(this));
       });
   }
+  /**
+   * Destroy the Abide instance
+   * @function
+   */
+  destroy() { super.destroy(); } // here for docs purposes only
 }
 
 /**
index 48c42f5fa211cf21ad889812e58ade06222b314e..69dacd479eb2c1f58423bcfa7ec823fb6819c988 100644 (file)
@@ -15,10 +15,15 @@ class Accordion extends Plugin {
   /**
    * Creates a new instance of an accordion.
    * @class
-   * @fires Accordion#init
    * @param {jQuery} element - jQuery object to make into an accordion.
    * @param {Object} options - a plain object with settings to override the default options.
    */
+  constructor(element, options = {}) { super(element, options); } // here for doc purposes only
+
+  /**
+   * Fires when the plugin has initialized
+   * @event Accordion#init
+   */
   _setup(element, options) {
     this.$element = element;
     this.options = $.extend({}, Accordion.defaults, this.$element.data(), options);
@@ -256,18 +261,23 @@ class Accordion extends Plugin {
   }
 
   /**
-   * Destroys an instance of an accordion.
-   * @fires Accordion#destroyed
-   * @function
+   * Fires when the plugin has been destroyed.
+   * @event Accordion#destroyed
    */
+
   _destroy() {
     this.$element.find('[data-tab-content]').stop(true).slideUp(0).css('display', '');
     this.$element.find('a').off('.zf.accordion');
     if(this.options.deepLink) {
       $(window).off('popstate', this._checkDeepLink);
     }
-
   }
+  /**
+   * Destroy the Accordion instance
+   * @function
+   */
+  destroy() { super.destroy(); } // here for docs purposes only
+
 }
 
 Accordion.defaults = {