You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
26 lines
701 B
26 lines
701 B
export default function(methods) { |
|
return { |
|
stream: transformer(methods) |
|
}; |
|
} |
|
|
|
export function transformer(methods) { |
|
return function(stream) { |
|
var s = new TransformStream; |
|
for (var key in methods) s[key] = methods[key]; |
|
s.stream = stream; |
|
return s; |
|
}; |
|
} |
|
|
|
function TransformStream() {} |
|
|
|
TransformStream.prototype = { |
|
constructor: TransformStream, |
|
point: function(x, y) { this.stream.point(x, y); }, |
|
sphere: function() { this.stream.sphere(); }, |
|
lineStart: function() { this.stream.lineStart(); }, |
|
lineEnd: function() { this.stream.lineEnd(); }, |
|
polygonStart: function() { this.stream.polygonStart(); }, |
|
polygonEnd: function() { this.stream.polygonEnd(); } |
|
};
|
|
|