]> BookStack Code Mirror - bookstack/blobdiff - dev/docs/components.md
Default OpenID display name set to standard value
[bookstack] / dev / docs / components.md
index 2f59ae3448d86520ea1691a03c345e3627a07ccd..ac0e929cdfe416a4454abf6ffa02929232a15c79 100644 (file)
@@ -1,16 +1,22 @@
 # JavaScript Components
 
 # JavaScript Components
 
-This document details the format for JavaScript components in BookStack.
+This document details the format for JavaScript components in BookStack. This is a really simple class-based setup with a few helpers provided.
 
 #### Defining a Component in JS
 
 ```js
 class Dropdown {
     setup() {
 
 #### Defining a Component in JS
 
 ```js
 class Dropdown {
     setup() {
+        this.toggle = this.$refs.toggle;
+        this.menu = this.$refs.menu;
+    
+        this.speed = parseInt(this.$opts.speed);
     }
 }
 ```
 
     }
 }
 ```
 
+All usage of $refs, $manyRefs and $opts should be done at the top of the `setup` function so any requirements can be easily seen.
+
 #### Using a Component in HTML
 
 A component is used like so:
 #### Using a Component in HTML
 
 A component is used like so: