Pro JavaScript Design Patterns 2008 phần 8 doc
... Protection Proxy The virtual proxy is probably the most useful type of proxy to JavaScript programmers. Let’s briefly go over the other types and explain why they aren’t as applicable to JavaScript. A ... 'tooltip'; document.getElementsByTagName('body')[0].appendChild(this.element); }; Tooltip.prototype = { startDelay: function(e, text) { CHAPTER 13 ■ THE FLYWEIGHT PAT...
Ngày tải lên: 12/08/2014, 23:20
... . . . . . . . 263 ■CONTENTS xiii 908Xch00FM.qxd 11/16/07 1:05 PM Page xiii f7670b 088 a34e6aa65a5 685 727db1ff4 Pro JavaScript ™ Design Patterns Copyright © 20 08 by Ross Harmes and Dustin Diaz All ... bar; }; })(); CHAPTER 1 ■ EXPRESSIVE JAVASCRIPT 7 908Xch01.qxd 11/15/07 10:31 AM Page 7 Pro JavaScript ™ Design Patterns Ross Harmes and Dustin Diaz 908Xch00FM.qxd 11/16/0...
Ngày tải lên: 12/08/2014, 23:20
... original JavaScript cre- ators. The prototype attribute is meant to point to the prototype object, and through prototype CHAPTER 4 ■ INHERITANCE 48 908Xch04a.qxd 11/15/07 10:34 AM Page 48 Using ... new Author('Dustin Diaz', [&apos ;JavaScript Design Patterns& apos;]); author[1] = new Author('Ross Harmes', [&apos ;JavaScript Design Patterns& apos;]); author[1].g...
Ngày tải lên: 12/08/2014, 23:20
Pro JavaScript Design Patterns 2008 phần 2 pps
... object-oriented design mentioned in the Gang of Four’s Design Patterns says “Program to an interface, not an implementation,” telling you how funda- mental this concept is. The problem is that JavaScript ... useful. In a large project, with many different programmers writing code, interfaces are essential. Often programmers are asked to use an API that hasn’t been written yet, or are...
Ngày tải lên: 12/08/2014, 23:20
Pro JavaScript Design Patterns 2008 phần 4 pptx
... { get(this).addClass('hello'); }); })(); CHAPTER 6 ■ CHAINING 88 7257ch06a.qxd 11/15/07 10:37 AM Page 88 Chaining In this chapter we look at JavaScript s ability to chain methods together. By using ... new _$(arguments); }; })(); CHAPTER 6 ■ CHAINING 85 7257ch06a.qxd 11/15/07 10:37 AM Page 85 Design Patterns PART 2 ■ ■ ■ 7257ch07.qxd 11/15/07 10: 38 AM Page 91 displayRes...
Ngày tải lên: 12/08/2014, 23:20
Pro JavaScript Design Patterns 2008 phần 5 potx
... null CHAPTER 8 ■ THE BRIDGE PATTERN1 18 908Xch08a.qxd 11/15/07 10:41 AM Page 1 18 The Bridge Pattern In the world of API implementations, bridges are incredibly useful. In fact, they’re probably one ... DED.Queue; q.setRetryCount(5); q.setTimeout(3000); var items = $('items'); CHAPTER 8 ■ THE BRIDGE PATTERN 117 908Xch08a.qxd 11/15/07 10:41 AM Page 117 The Composite Pattern The...
Ngày tải lên: 12/08/2014, 23:20
Pro JavaScript Design Patterns 2008 phần 6 pps
... setCSS(el, styles) { for ( var prop in styles ) { if (!styles.hasOwnProperty(prop)) continue; setStyle(el, prop, styles[prop]); } } CHAPTER 10 ■ THE FACADE PATTERN 145 908Xch10.qxd 11/15/07 10:57 ... a collection of poorly designed APIs by wrapping them in a single well-designed API. JavaScript Libraries As Facades JavaScript libraries are built for humans. They’re designed to save time,...
Ngày tải lên: 12/08/2014, 23:20
Pro JavaScript Design Patterns 2008 phần 7 ppsx
... browsers implement the console object: /* SimpleProfiler class. */ var SimpleProfiler = function(component) { this.component = component; }; SimpleProfiler.prototype = { buildList: function() { var ... that the property is a function. if(typeof this.bicycle[key] !== 'function') { continue outerloop; } CHAPTER 12 ■ THE DECORATOR PATTERN1 68 908Xch12.qxd 11/15/07 11:02 AM Page 1 68...
Ngày tải lên: 12/08/2014, 23:20
Pro JavaScript Design Patterns 2008 phần 9 pps
... instantiate. Benefits of the Proxy Pattern Each type of proxy has a different set of benefits. The remote proxy allows you to treat a remote resource as a local JavaScript object. This is obviously ... reduced) with good documentation. If programmers know what to expect, in terms of performance and reliability, they can use the proxy accordingly. All of this is true for the virtual proxy a...
Ngày tải lên: 12/08/2014, 23:20
Pro JavaScript Design Patterns 2008 phần 10 pptx
... 255–256 chains/chaining, 89 building chainable JavaScript library, 86 , 88 callbacks and, 89 –90 introduction to, 83 structure of, 84 86 _checkInitialization method, 211 checkIsbn method, 29, 37 child objects, 47– 48, ... pattern, 38, 66 basic structure of, 65–66 benefits of, 81 branching, 78 81 drawbacks of, 82 introduction to, 65 lazy loading, 75– 78, 82 namespacing, 66–...
Ngày tải lên: 12/08/2014, 23:20