Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

defineNodes to accept data structure instead of factory #11

Closed
benji6 opened this issue Oct 4, 2015 · 1 comment
Closed

defineNodes to accept data structure instead of factory #11

benji6 opened this issue Oct 4, 2015 · 1 comment

Comments

@benji6
Copy link
Owner

benji6 commented Oct 4, 2015

Currently defineNode is called with a factory like this:

const pingPongDelayParamsFactory = ({
  decay = 1 / 3,
  delayTime = 1 / 3,
  maxDelayTime = 1 / 3,
} = {}) => ({
  zero: ['stereoPanner', 'output', {pan: -1}],
  1: ['stereoPanner', 'output', {pan: 1}],
  2: ['delay', [1, 'five'], {delayTime, maxDelayTime}],
  3: ['gain', 2, {gain: decay}],
  4: ['delay', ['zero', 3], {delayTime, maxDelayTime}],
  five: ['gain', 4, {gain: decay}, 'input']
});

However, it would be good if instead it could be called with a data structure and have the same behaviour. This opens doors to safely importing 3rd party custom nodes. Propose an API something like this:

const pingPongDelayCustomNode = {
  zero: ['stereoPanner', 'output', {pan: -1}],
  1: ['stereoPanner', 'output', {pan: 1}],
  2: ['delay', [1, 'five'], {delayTime: '@@param/delayTime', maxDelayTime: '@@param/maxDelayTime'}],
  3: ['gain', 2, {gain: '@@param/decay'}],
  4: ['delay', ['zero', 3], {delayTime: '@@param/delayTime', maxDelayTime: '@@param/maxDelayTime'}],
  five: ['gain', 4, {gain: '@@param/decay'}, 'input']
};
@benji6 benji6 changed the title defineNode to accept data structure instead of factory defineNodes to accept data structure instead of factory Oct 5, 2015
@benji6
Copy link
Owner Author

benji6 commented Dec 27, 2015

I'm going to close this for now. Stateless function components in virtual-dom technologies does not seem to be a major issue, so will continue to use a similar pattern here for now.

@benji6 benji6 closed this as completed Dec 27, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant