Mercurial > js4py
annotate core-javascript/core-javascript-work/library.js @ 120:fef162a89a47 core-javascript
Add test_library.js (and fruit example).
| author | Jonathan Fine <jfine@pytex.org> |
|---|---|
| date | Sun, 30 Oct 2011 16:54:56 +0000 |
| parents | ccd7dbe83849 |
| children | 20d76c716c9d |
| rev | line source |
|---|---|
| 117 | 1 // start create |
| 2 var create = function(parent){ | |
| 118 | 3 |
| 117 | 4 var tmp = function(){}; |
| 5 tmp.prototype = parent; | |
| 6 var child = new tmp(); | |
| 118 | 7 |
| 117 | 8 return child; |
| 9 }; | |
| 10 // end create | |
| 118 | 11 |
| 12 | |
| 13 // start SimpleClass | |
| 14 var SimpleClass = function(prototype){ | |
| 15 | |
| 16 var cls = function(){ | |
| 17 | |
| 18 var instance = create(prototype); | |
| 19 instance.__init__.apply(instance, arguments); | |
| 20 return instance; | |
| 21 }; | |
| 22 | |
| 23 return cls; | |
| 24 }; | |
| 25 // end SimpleClass |
