ryanve / response.js

Responsive design toolkit
http://responsejs.com
Other
801 stars 123 forks source link

Error: create @fn #11

Closed alanhogan closed 12 years ago

alanhogan commented 12 years ago

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

alanhogan commented 12 years ago

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 commented 12 years ago

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 commented 12 years ago

@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 commented 12 years ago

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 commented 12 years ago

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

alanhogan commented 12 years ago

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 commented 12 years ago

@alanhogan Right on =]