1. Trang chủ
  2. » Công Nghệ Thông Tin

CoffeeScript accelerated javascript development

154 32 0

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

THÔNG TIN TÀI LIỆU

Thông tin cơ bản

Định dạng
Số trang 154
Dung lượng 3,21 MB

Nội dung

Free ebooks ==> ww www.ebook777.com w.ebook777.com oks ==> free ebo www.it-ebooks.info WWW.EBOOK777.COM Free ebooks ==> ww www.ebook777.com w.ebook777.com oks ==> free ebo What readers are saying about CoffeeScript: Accelerated JavaScript Development It’s hard to imagine a new web application today that doesn’t make heavy use of JavaScript, but if you’re used to something like Ruby, it feels like a significant step down to deal with JavaScript, more of a chore than a joy Enter CoffeeScript: a pre-compiler that removes all the unnecessary verbosity of JavaScript and simply makes it a pleasure to write and read Go, go, Coffee! This book is a great introduction to the world of CoffeeScript ➤ David Heinemeier Hansson Creator, Rails Just like CoffeeScript itself, Trevor gets straight to the point and shows you the benefits of CoffeeScript and how to write concise, clear CoffeeScript code ➤ Scott Leberknight Chief Architect, Near Infinity Though CoffeeScript is a new language, you can already find it almost everywhere This book will show you just how powerful and fun CoffeeScript can be ➤ Stan Angeloff Managing Director, PSP WebTech Bulgaria www.it-ebooks.info WWW.EBOOK777.COM Free ebooks ==> ww www.ebook777.com w.ebook777.com oks ==> free ebo This book helps readers become better JavaScripters in the process of learning CoffeeScript What’s more, it’s a blast to read, especially if you are new to CoffeeScript and ready to learn ➤ Brendan Eich Creator, JavaScript CoffeeScript may turn out to be one of the great innovations in web application development; since I first discovered it, I’ve never had to write a line of pure JavaScript I hope the readers of this wonderful book will be able to say the same ➤ Dr Nic Williams CEO/Founder, Mocra CoffeeScript: Accelerated JavaScript Development is an excellent guide to CoffeeScript from one of the community’s most esteemed members It’ll help you get up to speed with the language in no time, whether you write code that runs in the browser or on the server Trevor’s book belongs on every CoffeeScript developer’s shelf ➤ Sam Stephenson Creator, Prototype JavaScript framework www.it-ebooks.info WWW.EBOOK777.COM Free ebooks ==> ww www.ebook777.com w.ebook777.com oks ==> free ebo CoffeeScript is one of the most interesting developments in the world of programming languages in the last few years Taking the lessons learned over the last decade from languages like Ruby and Python, it is a language with immense expressive power CoffeeScript: Accelerated JavaScript Development is your guide to this new language and a must-read for those interested in being productive in JavaScript ➤ Travis Swicegood Author, Pragmatic Version Control Using Git Trevor serves up a rich blend of language overview and real-world examples, showcasing why I consider CoffeeScript my secret weapon for iOS, Android, and WebOS mobile development ➤ Wynn Netherland Co-host, The Changelog Fasten your seat belt and enjoy the ride with Trevor Burnham from JavaScript to CoffeeScript and have fun with web development again ➤ Javier Collado QA Automation Engineer, Canonical Ltd www.it-ebooks.info WWW.EBOOK777.COM Free ebooks ==> ww www.ebook777.com w.ebook777.com oks ==> free ebo CoffeeScript Accelerated JavaScript Development Trevor Burnham The Pragmatic Bookshelf Dallas, Texas • Raleigh, North Carolina www.it-ebooks.info WWW.EBOOK777.COM Free ebooks ==> ww www.ebook777.com w.ebook777.com oks ==> free ebo Many of the designations used by manufacturers and sellers to distinguish their products are claimed as trademarks Where those designations appear in this book, and The Pragmatic Programmers, LLC was aware of a trademark claim, the designations have been printed in initial capital letters or in all capitals The Pragmatic Starter Kit, The Pragmatic Programmer, Pragmatic Programming, Pragmatic Bookshelf, PragProg and the linking g device are trademarks of The Pragmatic Programmers, LLC Every precaution was taken in the preparation of this book However, the publisher assumes no responsibility for errors or omissions, or for damages that may result from the use of information (including program listings) contained herein Our Pragmatic courses, workshops, and other products can help you and your team create better software and have more fun For more information, as well as the latest Pragmatic titles, please visit us at http://pragprog.com The team that produced this book includes: Michael Swaine (editor) Potomac Indexing, LLC (indexer) Kim Wimpsett (copyeditor) David Kelly (typesetter) Janet Furlow (producer) Juliet Benda (rights) Ellie Callahan (support) Copyright © 2011 Pragmatic Programmers, LLC All rights reserved No part of this publication may be reproduced, stored in a retrieval system, or transmitted, in any form, or by any means, electronic, mechanical, photocopying, recording, or otherwise, without the prior consent of the publisher Printed in the United States of America ISBN-13: 978-1-934356-78-4 Printed on acid-free paper Book version: P1.0—July 2011 www.it-ebooks.info WWW.EBOOK777.COM Free ebooks ==> ww www.ebook777.com w.ebook777.com oks ==> free ebo Contents Foreword Acknowledgments Preface Getting Started 1.1 Installing CoffeeScript 1.2 Text Editors for CoffeeScript 1.3 Meet ’coffee’ 1.4 Debugging CoffeeScript Functions, Scope, and Context 2.1 Functions 101 2.2 Scope: Where You See ’Em 2.3 Context (or, “What Is ’this’?”) 2.4 Property Arguments (@arg) 2.5 Default Arguments (arg =) 2.6 Splats ( ) 2.7 Project: 5x5 Input Parser 2.9 Exercises Collections and Iteration 3.1 Objects as Hashes 3.2 Arrays 3.3 Iterating over Collections 3.4 Conditional Iteration 3.5 Comprehensions 3.6 Pattern Matching (or, Destructuring Assignment) 3.7 Project: 5x5 Solitaire 3.9 Exercises www.it-ebooks.info WWW.EBOOK777.COM xi xiii xv 1 13 13 18 21 24 25 28 29 34 37 37 40 43 46 47 48 50 56 Free ebooks ==> ww www.ebook777.com w.ebook777.com oks ==> free ebo • viii Modules and Classes 4.1 Modules: Splitting Up Apps 4.2 The Power of Prototypes 4.3 Classes: Functions with Prototypes 4.4 Inheritance with ’extends’ 4.5 Project: Refactoring 5x5 4.7 Exercises 59 60 61 63 65 68 72 Web 5.1 5.2 5.3 5.4 5.5 5.7 75 76 76 77 79 80 88 Server-Side Apps with Node.js 6.1 What Is Node.js? 6.2 Modularizing Code with ’exports’ and ’require’ 6.3 Thinking Asynchronously 6.4 Project: Multiplayer 5x5 6.6 Exercises 91 91 92 93 97 105 Interactivity with jQuery The Tao of jQuery Manipulating the DOM Getting Selective Reacting to Events Project: Browser-Based 5x5 Exercises A1 Answers to Exercises A1.1 Functions, Scope, and Context A1.2 Collections and Iteration A1.3 Modules and Classes A1.4 Web Interactivity with jQuery A1.5 Server-Side Apps with Node.js A2 Ways of Running CoffeeScript A2.1 Web Consoles A2.2 Running CoffeeScript in Your Web App A2.3 CoffeeScript on Rails A2.4 CoffeeScript via Middleware A2.5 CoffeeScript on Node.js A2.6 Rapid Websites with Middleman A2.7 CoffeeScript for System Scripts 107 107 109 111 112 113 115 115 116 116 117 117 118 119 www.it-ebooks.info WWW.EBOOK777.COM Free ebooks ==> ww www.ebook777.com w.ebook777.com oks ==> free ebo • A3 Cheat Sheet for JavaScripters A3.1 Boolean Operators A3.2 The Existential Operator A3.3 Context and Prototype Accessors A3.4 Function Definitions A3.5 Conditionals A3.6 Property Existence A3.7 Iteration A4 Bibliography Index www.it-ebooks.info WWW.EBOOK777.COM 121 121 121 122 122 122 122 123 ix 125 127 Free ebooks ==> ww www.ebook777.com w.ebook777.com oks ==> free ebo • www.it-ebooks.info WWW.EBOOK777.COM x ... readers are saying about CoffeeScript: Accelerated JavaScript Development It’s hard to imagine a new web application today that doesn’t make heavy use of JavaScript, but if you’re used to something... expressive power CoffeeScript: Accelerated JavaScript Development is your guide to this new language and a must-read for those interested in being productive in JavaScript ➤ Travis Swicegood Author,... strings are just JavaScript strings, and its numbers are just JavaScript numbers; even its classes work in JavaScript frameworks like Backbone.js.5 So don’t be afraid of calling JavaScript code

Ngày đăng: 04/03/2019, 16:01