|
Last change
on this file since e4c61dd was e4c61dd, checked in by istevanoska <ilinastevanoska@…>, 6 months ago |
|
Prototype 1.1
|
-
Property mode
set to
100644
|
|
File size:
701 bytes
|
| Line | |
|---|
| 1 | export default function(methods) {
|
|---|
| 2 | return {
|
|---|
| 3 | stream: transformer(methods)
|
|---|
| 4 | };
|
|---|
| 5 | }
|
|---|
| 6 |
|
|---|
| 7 | export function transformer(methods) {
|
|---|
| 8 | return function(stream) {
|
|---|
| 9 | var s = new TransformStream;
|
|---|
| 10 | for (var key in methods) s[key] = methods[key];
|
|---|
| 11 | s.stream = stream;
|
|---|
| 12 | return s;
|
|---|
| 13 | };
|
|---|
| 14 | }
|
|---|
| 15 |
|
|---|
| 16 | function TransformStream() {}
|
|---|
| 17 |
|
|---|
| 18 | TransformStream.prototype = {
|
|---|
| 19 | constructor: TransformStream,
|
|---|
| 20 | point: function(x, y) { this.stream.point(x, y); },
|
|---|
| 21 | sphere: function() { this.stream.sphere(); },
|
|---|
| 22 | lineStart: function() { this.stream.lineStart(); },
|
|---|
| 23 | lineEnd: function() { this.stream.lineEnd(); },
|
|---|
| 24 | polygonStart: function() { this.stream.polygonStart(); },
|
|---|
| 25 | polygonEnd: function() { this.stream.polygonEnd(); }
|
|---|
| 26 | };
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.