Home Page Icon
Home Page
Table of Contents for
Title
Close
Title
by Den Odell
Pro JavaScript Development: Coding, Capabilities, and Tooling
Cover
Title
Copyright
Dedication
Contents at a Glance
Contents
About the Author
About the Technical Reviewers
Acknowledgments
Introduction
Chapter 1: Object-Oriented JavaScript
Objects in JavaScript
Custom Objects
Classes
Coding Conventions And Naming
Rule 1: Use descriptive names
Rule 2: Begin with a lowercase letter
Rule 3: Use camel-case to represent word divisions
Rule 4: Use all uppercase characters to represent universal constants
Rule 5: Group together variable declarations in one statement at the top of every function block
ECMAScript 5
JSON Data Format Parsing
Strict Mode
Function binding
Array Methods
Object Methods
Summary
Chapter 2: Documenting JavaScript
Inline and Block Comments
Structured JavaScript Documentation
The YUIDoc Documentation Format
Documenting “Classes”, Constructors, Properties and Methods
Documenting Events
Documenting Code Examples
Other YUIDoc Documentation Tags
Expressive Documentation Formatting – Markdown
Grouping Content Under Headings
Breaking Lines And Creating Paragraphs
Creating Lists
Emphasizing Text
Displaying Code
Adding Quotes
Linking To URLs
Inserting Images
Creating Horizontal Rules
Using Backslash To Insert Reserved Characters
For Everything Else, There’s HTML
Creating a Documentation Website Using YUIDoc
Taking It Further
Summary
Chapter 3: Writing High-Quality JavaScript
Performing Static Code Analysis
JSLint
JSHint
Google Closure Compiler and Linter
Choosing a Static Code Analysis Tool
Unit Testing In JavaScript
Unit Testing Frameworks For JavaScript
Using Jasmine For JavaScript Unit Testing
Handling Runtime Errors
JavaScript’s Native Error Types
Wrap Code That May Error In A try-catch Statement
Detecting The Type Of Error Thrown
Creating Custom Error Types
Measuring Code Quality
Unit Test Code Coverage
Measuring Code Complexity
Summary
Chapter 4: Boosting JavaScript Performance
Improving Page Loading Time
HTML Tag Order Matters
GZip Encode Delivery Of Your JavaScript Files
Minification, Obfuscation, and Compilation
Lazy Loading JavaScript Files On Demand
Optimize Document Object Manipulation
Minimise Access to Page Elements
Close Existing Elements Where Possible
Utilise The Offline DOM
Use CSS To Manipulate Page Styles Rather Than JavaScript
Improving DOM Event Performance
Delegate Events To Parent Elements
Handle Rapid-Fire Events With Framing
Improving Function Performance
Storing Previous Function Return Values With Memoization
Faster String Manipulation With Regular Expressions
Faster Use Of Arrays
Fast Array Creation
Fast Array Looping
Offload Intensive Tasks To Web Workers
Using a Web Worker to Process Image Data
Basic Performance Measurements
Summary
Chapter 5: Design Patterns: Creational
What Are Design Patterns?
Creational Design Patterns
The Factory Pattern
The Abstract Factory Pattern
The Builder Pattern
The Prototype Pattern
The Singleton Pattern
Summary
Chapter 7: Design Patterns: Behavioral
The Chain of Responsibility Pattern
The Command Pattern
The Iterator Pattern
The Observer Pattern
The Mediator Pattern
The Memento Pattern
The Promises Pattern
The Strategy Pattern
Summary
Chapter 8: Design Patterns: Architectural
The Model-View-Controller (MVC) Pattern
The Model-View-Presenter (MVP) Pattern
The Model-View-ViewModel (MVVM) Pattern
Architectural Pattern Frameworks
Summary
Chapter 9: Managing Code File Dependencies
Using RequireJS to Manage Code File Dependencies
Loading and Initializing RequireJS
Using Aliases For Module Names
Content Delivery Networks and Fallbacks
Creating Modules
Loading Additional Scripts On Demand
The RequireJS Code Optimizer Tool
Additional Plugins for RequireJS
Alternatives To RequireJS
Summary
Chapter 10: Mobile JavaScript Development
The Constraints of Mobile Web Development
Battery Life
Network Bandwidth Speeds And Latency
On-Board Memory Size
Operating System Responsiveness
Accessing Mobile Device Sensors with JavaScript
Accessing The Geolocation Sensor
Accessing The Touch Sensor
Accessing The Orientation and Direction Sensors
Accessing The Motion Sensor
The Missing Sensors
Event Framing For Sensor Data
Taking Sensor Data Further
Network Connection Failures And Offline States
Detecting Online and Offline States
Persisting Data With The Web Storage API
The HTML5 Application Cache
JavaScript For Responsive Design
Summary
Chapter 11: Building Games with Canvas API
Basic Drawing Operations in Canvas
High-Definition Canvas Elements
Building Games Using Canvas
Drawing Images onto a Canvas
Animation in Canvas
Game Control
Collision Detection
The Game Loop
Layering Canvases for Better Performance
Building a “Frogger” Game in Canvas
Summary
Chapter 12: Using WebRTC for Video Chat
The WebRTC Specification
Accessing the Webcam and Microphone
Creating a Simple Video Chat Web Application
Connection and Signalling
Building the Video Chat Client
Summary
Chapter 13: Using Client-Side Templates
Dynamically Updating Page Content
Loading HTML Dynamically Via Ajax
Client-Side Templating
Client-Side Templating without a Library
Client-Side Templating with Mustache.js
Client-Side Templating with Handlebars.js
Alternative Client-Side Templating Libraries
Consider Progressive Enhancement
Summary
Chapter 14: The Node.js Application Platform
Installing Node.js
Writing Node.js Applications
The Console
Loading Modules
Node.js Packages
Splitting a Node.js Application across Multiple Files
Node.js Frameworks for Web Applications
Express
Socket.IO
Node.js Hosting
Summary
Chapter 15: Build Tools and Automation
Build Tools
Grunt—The JavaScript Task Runner
Gulp.js—The Streaming Build System
Using Build Tools to Automate Common Tasks
Managing Third-Party Libraries and Frameworks
Project Setup and Scaffolding
Summary
Chapter 16: Browser Developer Tools
Locating the Hidden Browser Developer Tools
The JavaScript Console
Outputting Messages to the Console Window
Using the Console for Performance Measurement
Remove Code References to the Console Object for Release
Debugging Running JavaScript Code
Working with Minified Code
Pause and Observe Running JavaScript Code
Profiling JavaScript Code
Locating Memory Leaks
Identifying Performance Bottlenecks
Summary
Index
Search in book...
Toggle Font Controls
Playlists
Add To
Create new playlist
Name your new playlist
Playlist description (optional)
Cancel
Create playlist
Sign In
Email address
Password
Forgot Password?
Create account
Login
or
Continue with Facebook
Continue with Google
Sign Up
Full Name
Email address
Confirm Email Address
Password
Login
Create account
or
Continue with Facebook
Continue with Google
Prev
Previous Chapter
Cover
Next
Next Chapter
Copyright
Pro JavaScript Development
Coding, Capabilities, and Tooling
Den Odell
Add Highlight
No Comment
..................Content has been hidden....................
You can't read the all page of ebook, please click
here
login for view all page.
Day Mode
Cloud Mode
Night Mode
Reset