JavaScript patterns
What's the best approach for developing an application with JavaScript? This book helps you answer that question with numerous JavaScript coding patterns and best practices. If you're an experienced developer looking to solve problems related to objects, functions, inheritance, and other l...
Otros Autores: | |
---|---|
Formato: | Libro electrónico |
Idioma: | Inglés |
Publicado: |
Sebastopol :
O'Reilly
[2010]
|
Edición: | 1st edition |
Materias: | |
Ver en Biblioteca Universitat Ramon Llull: | https://discovery.url.edu/permalink/34CSUC_URL/1im36ta/alma991009628168306719 |
Tabla de Contenidos:
- Table of Contents; Preface; Target Audience; Conventions Used in This Book; Using Code Examples; Safari® Books Online; How to Contact Us; Acknowledgments; Credits; Reading; Chapter 1. Introduction; Patterns; JavaScript: Concepts; Object-Oriented; No Classes; Prototypes; Environment; ECMAScript 5; JSLint; The Console; Chapter 2. Essentials; Writing Maintainable Code; Minimizing Globals; The Problem with Globals; Side Effects When Forgetting var; Access to the Global Object; Single var Pattern; Hoisting: A Problem with Scattered vars; for Loops; for-in Loops
- (Not) Augmenting Built-in Prototypesswitch Pattern; Avoiding Implied Typecasting; Avoiding eval(); Number Conversions with parseInt(); Coding Conventions; Indentation; Curly Braces; Opening Brace Location; White Space; Naming Conventions; Capitalizing Constructors; Separating Words; Other Naming Patterns; Writing Comments; Writing API Docs; YUIDoc Example; Writing to Be Read; Peer Reviews; Minify...In Production; Run JSLint; Summary; Chapter 3. Literals and Constructors; Object Literal; The Object Literal Syntax; Objects from a Constructor; Object Constructor Catch; Custom Constructor Functions
- Constructor's Return ValuesPatterns for Enforcing new; Naming Convention; Using that; Self-Invoking Constructor; Array Literal; Array Literal Syntax; Array Constructor Curiousness; Check for Array-ness; JSON; Working with JSON; Regular Expression Literal; Regular Expression Literal Syntax; Primitive Wrappers; Error Objects; Summary; Chapter 4. Functions; Background; Disambiguation of Terminology; Declarations Versus Expressions: Names and Hoisting; Function's name Property; Function Hoisting; Callback Pattern; A Callback Example; Callbacks and Scope; Asynchronous Event Listeners; Timeouts
- Callbacks in LibrariesReturning Functions; Self-Defining Functions; Immediate Functions; Parameters of an Immediate Function; Returned Values from Immediate Functions; Benefits and Usage; Immediate Object Initialization; Init-Time Branching; Function Properties-A Memoization Pattern; Configuration Objects; Curry; Function Application; Partial Application; Currying; When to Use Currying; Summary; Chapter 5. Object Creation Patterns; Namespace Pattern; General Purpose Namespace Function; Declaring Dependencies; Private Properties and Methods; Private Members; Privileged Methods
- Privacy FailuresObject Literals and Privacy; Prototypes and Privacy; Revealing Private Functions As Public Methods; Module Pattern; Revealing Module Pattern; Modules That Create Constructors; Importing Globals into a Module; Sandbox Pattern; A Global Constructor; Adding Modules; Implementing the Constructor; Static Members; Public Static Members; Private Static Members; Object Constants; Chaining Pattern; Pros and Cons of the Chaining Pattern; method() Method; Summary; Chapter 6. Code Reuse Patterns; Classical Versus Modern Inheritance Patterns
- Expected Outcome When Using Classical Inheritance