Guest User

Untitled

a guest
Nov 15th, 2018
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.99 KB | None | 0 0
  1. ### Using Controllers
  2. * Use `Controllers`, which are function declarations that contain public and private methods
  3. * For example:
  4.  
  5. ```javascript
  6. var budgetController = function() {
  7. // declare private functions here
  8. var functionOne = function() {
  9.  
  10. }
  11.  
  12. // declare other variables and data structures
  13.  
  14. // in order to return public functions, you must return them in an object!
  15. // CLOSURES!
  16. return {
  17. pubFunctionOne: function() {
  18.  
  19. },
  20.  
  21. pubFunctionTwo: function() {
  22.  
  23. }
  24. }
  25.  
  26. }
  27.  
  28. ```
  29.  
  30. ---
  31. ### HTML DOM Element Creation
  32. * You can create DOM elements in a string
  33. * For content that needs interpolation or a real value, insert a placeholder: `%example%`
  34. * To insert a value into this location: `htmlString.replace("%example%", actualValue)`
  35. * Then re-insert this newly editted string to the DOM element!
  36.  
  37. ---
  38. ### JS DOM Element Querying
  39. * Save all queried strings into an object (in case the element needs to be re-queried)
  40. * `var DOMElements = { btn: ".btn"}`
Add Comment
Please, Sign In to add comment