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

I only hear 1 beep. #1

Closed
lgarron opened this issue Jun 11, 2013 · 3 comments · Fixed by #2
Closed

I only hear 1 beep. #1

lgarron opened this issue Jun 11, 2013 · 3 comments · Fixed by #2

Comments

@lgarron
Copy link

lgarron commented Jun 11, 2013

I want my money back.

@feross
Copy link
Owner

feross commented Jun 11, 2013

User error. ;-)

var beep = require('beepbeep')

beep(); beep();

@lgarron
Copy link
Author

lgarron commented Jun 11, 2013

But it's all about chaining these days. Why not beep.beep() or at least beep().beep()? A proof of concept:

exports = module.exports = (function() {
  function repeatStr(s, n){t = ""; for(i = 0; i < n; i++){t += s;}; return t;}
  var f = [function() {console.log('\007');}];
  for (var i = 1; i < 32; i++) { f[i-1].beep = f[i] = (function(i){console.log(repeatStr('\007', i+1));}).bind(this, i);}
  return f[0];
})();

Then you can just call:

beep.beep.beep.beep();

@feross
Copy link
Owner

feross commented Jun 11, 2013

👍 Send it as a pull request!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants