Главная| Трекер ▼| Поиск| Правила| FAQ| |
Автор | Сообщение |
---|---|
valeri[µ]
Модератор ![]() Сообщения: 7870 ![]() |
![]() JavaScript Web Applications Год: August 30, 2011 Автор: Alex MacCaw Жанр: Web программирование Издательство: O'Reilly Media ISBN: 144930351X Язык: Английский Формат: PDF Качество: Изначально компьютерное (eBook) Количество страниц: 280 Описание: Building rich JavaScript applications that bring a desktop experience to the Web requires moving state from the server to the client side—not a simple task. This hands-on book takes proficient JavaScript developers through all the steps necessary to create state-of-the-art applications, including structure, templating, frameworks, communicating with the server, and many other issues. Throughout the book, you'll work with real-world example applications to help you grasp the concepts involved. Learn how to create JavaScript applications that offer a more responsive and improved experience. Use the Model-View-Controller (MVC) pattern, and learn how to manage dependencies inside your application Get an introduction to templating and data binding Learn about loading remote data, Ajax, and cross-domain requests Create realtime applications with WebSockets and Node.js Accept dropped files and upload data with progress indicators Use major frameworks and libraries, including jQuery, Spine, and Backbone Write tests and use the console to debug your applications Get deployment best practices, such as caching and minification 1. MVC and Classes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 Early Days 1 Adding Structure 2 What Is MVC? 2 The Model 3 The View 4 The Controller 5 Toward Modularity, Creating Classes 6 Adding Functions to Classes 7 Adding Methods to Our Class Library 8 Class Inheritance Using Prototype 10 Adding Inheritance to Our Class Library 11 Function Invocation 12 Controlling Scope in Our Class Library 14 Adding Private Functions 16 Class Libraries 16 2. Events and Observing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19 Listening to Events 19 Event Ordering 20 Canceling Events 21 The Event Object 21 Event Libraries 23 Context Change 24 Delegating Events 24 Custom Events 25 Custom Events and jQuery Plug-Ins 25 Non-DOM Events 27 3. Models and Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .. . . . . . . 31 MVC and Namespacing 31 Building an ORM 32 Prototypal Inheritance 33 Adding ORM Properties 34 Persisting Records 35 Adding ID Support 36 Addressing References 37 Loading in Data 38 Including Data Inline 39 Loading Data with Ajax 39 JSONP 43 Security with Cross-Domain Requests 43 Populating Our ORM 44 Storing Data Locally 44 Adding Local Storage to Our ORM 46 Submitting New Records to the Server 47 4. Controllers and State . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49 Module Pattern 50 Global Import 50 Global Export 50 Adding a Bit of Context 51 Abstracting into a Library 52 Loading Controllers After the Document 53 Accessing Views 55 Delegating Events 56 State Machines 58 Routing 60 Using the URL’s Hash 60 Detecting Hash Changes 61 Ajax Crawling 62 Using the HTML5 History API 63 5. Views and Templating . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65 Dynamically Rendering Views 65 Templates 66 Template Helpers 68 Template Storage 69 Binding 70 Binding Up Models 71 6. Dependency Management . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 73 CommonJS 74 Declaring a Module 74 Modules and the Browser 75 Module Loaders 76 Yabble 76 RequireJS 77 Wrapping Up Modules 78 Module Alternatives 79 LABjs 80 FUBCs 80 7. Working with Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 81 Browser Support 81 Getting Information About Files 81 File Inputs 82 Drag and Drop 83 Dragging 84 Dropping 85 Cancel Default Drag/Drop 86 Copy and Paste 87 Copying 87 Pasting 88 Reading Files 89 Blobs and Slices 90 Custom Browse Buttons 91 Uploading Files 91 Ajax Progress 93 jQuery Drag and Drop Uploader 95 Creating a Drop Area 95 Uploading the File 95 8. The Real-Time Web . . . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . 97 Real Time’s History 97 WebSockets 98 Node.js and Socket.IO 101 Real-Time Architecture 103 Perceived Speed 105 9. Testing and Debugging . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 107 Unit Testing 109 Assertions 109 QUnit 110 Jasmine 113 Drivers 115 Headless Testing 118 Zombie 119 Ichabod 121 Distributed Testing 121 Providing Support 122 Inspectors 122 Web Inspector 123 Firebug 124 The Console 125 Console Helpers 126 Using the Debugger 127 Analyzing Network Requests 128 Profile and Timing 129 10. Deploying . . . . . . . . . . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . 133 Performance 133 Caching 134 Minification 136 Gzip Compression 137 Using a CDN 138 Auditors 138 Resources 139 11. The Spine Library . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 141 Setup 141 Classes 142 Instantiation 142 Extending Classes 143 Context 144 Events 145 Models 145 Fetching Records 147 Model Events 147 Validation 148 Persistence 148 Controllers 150 Proxying 151 Elements 152 Delegating Events 152 Controller Events 153 Global Events 153 The Render Pattern 154 The Element Pattern 154 Building a Contacts Manager 156 Contact Model 157 Sidebar Controller 158 Contacts Controller 160 App Controller 163 12. The Backbone Library . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 165 Models 165 Models and Attributes 166 Collections 167 Controlling a Collection’s Order 169 Views 169 Rendering Views 170 Delegating Events 170 Binding and Context 171 Controllers 172 Syncing with the Server 174 Populating Collections 175 On the Server Side 175 Custom Behavior 176 Building a To-Do List 178 13. The JavascriptMVC Library . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . 185 Setup 186 Classes 186 Instantiation 186 Calling Base Methods 187 Proxies 187 Static Inheritance 187 Introspection 188 A Model Example 188 Model 189 Attributes and Observables 189 Extending Models 191 Setters 191 Defaults 192 Helper Methods 192 Service Encapsulation 193 Type Conversion 196 CRUD Events 196 Using Client-Side Templates in the View 197 Basic Use 197 jQuery Modifiers 198 Loading from a Script Tag 198 $.View and Subtemplates 198 Deferreds 199 Packaging, Preloading, and Performance 199 $.Controller: The jQuery Plug-in Factory 200 Overview 202 Controller Instantiation 202 Event Binding 203 Templated Actions 204 Putting It All Together: An Abstract CRUD List 205 A. jQuery Primer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 207 B. CSS Extensions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 217 C. CSS3 Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 223 Index . . . . . . . . . . . . . . . . . . . . . . . .. . . . . . . . . . . . . . . . . . . . . . . 243 About the Author Alex MacCaw is a Ruby/JavaScript developer & entrepreneur. He has written a JavaScript framework, Spine and developed major applications including Taskforce and Socialmod, as well as a host of open source work. He speaks at Ruby/Rails conferences in NYC, SF and Berlin. In addition to programming he is currently traveling round the world with a Nikon D90 and surfboard. JavaScript Web Applications Book Review Помоги нашему сайту на расходы за сервер и качай торренты НЕОГРАНИЧЕННО!Пожертвовать 100 ₽ ![]() Или 2204 1201 2214 8816, с комментарием "Помощь трекеру" Связь с администрацией |
Страница 1 из 1 |
![]() |
|