Skip to content

Error: create @fn #11

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

Closed
alanhogan opened this issue Jul 19, 2012 · 7 comments
Closed

Error: create @fn #11

alanhogan opened this issue Jul 19, 2012 · 7 comments

Comments

@alanhogan
Copy link

Tried to set up some responsive content following the pattern described in #10, but response.js is throwing an error create @fn.

@alanhogan
Copy link
Author

Though it happens even when there isn’t anything actually using response.js on the page. Maybe I’m a bad copy/paster. I’ll figure this out…

@alanhogan
Copy link
Author

Eh it seems, though I’m not sure, that I wasn’t creating the test properly. Was using CoffeeScript and my closure might have been compiling to something just a bit different from what I intended.

@ryanve
Copy link
Owner

ryanve commented Jul 19, 2012

@alanhogan I guess you figured out. The code in #10 definitely works, but in order to make it safe for compiling with the Closure Compiler in Advanced mode you'd have to assign the hash property names using array notation:

var hash = {};
hash['lo'] = 0;
hash['med'] = 481;
hash['hi'] = 961;

Maybe the CoffeeScript compiler needs that too.

@alanhogan
Copy link
Author

Thanks, Ryan. CoffeeScript doesn’t seem to need that, but I did switch to use this closure syntax:

(do (R = Response) -> stuff)

Which gets compiled to pretty much exactly the code in your example over at #10.

@ryanve
Copy link
Owner

ryanve commented Jul 19, 2012

@alanhogan Sure thing�—that CoffeeScript is hella terse. ;) I haven't got into it really but I like its minimal syntax.

@alanhogan
Copy link
Author

The CoffeeScript site is a super handy reference and its realtime converter is aces for checking your understanding or the finer points of its conversion to JavaScript. I’m not a superpro, but do feel free to reach out to me if you have any CoffeeScript questions!

@ryanve
Copy link
Owner

ryanve commented Jul 19, 2012

@alanhogan Right on =]

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

No branches or pull requests

2 participants