rapid web development
play

Rapid Web Development Tips and tricks for Front End Development - PowerPoint PPT Presentation

Rapid Web Development Tips and tricks for Front End Development Javascript versions - ECMA 3 [Most successful yet] - ECMA 4 [Most unsuccessful] - ECMA 5 [Latest approved and live version] - ECMA 6 [Under development] Javascript cool parts


  1. Rapid Web Development Tips and tricks for Front End Development

  2. Javascript versions - ECMA 3 [Most successful yet] - ECMA 4 [Most unsuccessful] - ECMA 5 [Latest approved and live version] - ECMA 6 [Under development]

  3. Javascript cool parts

  4. what is prototype and __proto__ - Its native (not related to any library) - Usage + Lightweight instances + Used for inheritance

  5. How does it work

  6. hoisting - All variable declared anywhere in the current scope always reach at the top

  7. how does it work ?

  8. Performance Optimization

  9. Closures

  10. why do closures leak? - Activation object is the state when a function is being created. - Calling a function means pushing execution context on top of activation object - In case of closures, leak happens because execution context remains alive in the form of activation object of closure function. - Solution - define closure function seperately - copy the variables you need from parent.

  11. Visualize the leak

  12. DOM Access is costly

  13. Reduce DOM Access

  14. Do it offline - and then push it - use document.create() - use element.cloneNode() - use document.createDocumentFragment()

  15. Don't use window.setInterval - use requestAnimationFrame - a performance optimization tip - Pauses the timer when the page is inactive

  16. Reflow and Repaint

  17. Reflow and Repaint - DOM Tree and Render tree are maintained for every HTML document - Layout changes cause reflow + repaint - Color changes cause only repaints

  18. Reflow and Repaint - How to minimize cost - setAttribute("style", "....") - use className - hide it - position absolute - copy -> change -> replace node

  19. Cool Development Tools

  20. Chrome Dev Tools (Tips) - Drag and drop in Elements panel - Undo (Ctrl+z) and Redo (Ctrl+Shift+z) in elements panel - Open files list (Ctrl + o) - Open member (Ctrl + Shift + o) - Recently touched nodes ($0 - $4) - Conditional breakpoints - View pseudo classes and add new - Multiline console (Press shift) - Prettify the scripts - Pause on error/exception - Dock to right - Console in any panel - Search in all scripts - Preserve log on navigation

  21. Sublime Text - 2 - Bird eye view - Easy package installer - Really fast - Web Dev plugins (ZEN coding, etc.) - Accepts textmate plugins - Accepts custom build process - Supports VIM!

  22. Use ZEN coding

  23. Write test cases - Really good code practice - Slows down development in short term but you won't regret writing it later - Avoids bugs - Prevents kids from changing your code's behaviour - Your are more confident about your code - Yeah, makes you better than others :-)

  24. Cooler stuff in JS

  25. New DOM API - querySelector, querySelectorAll - classList - matchesSelector - Element.focus() - outerHTML - insertAdjacentHTML - scrollIntoView - contains()

  26. Questions? Amit Agarwal Web Developer, Google http://www.amitagrwal.com

Recommend


More recommend