javascript - How can I reuse coffeescript code? -


coffeescript encapsulate functions in 1 file. nice, brings me problem:

let's have coffeescript library, let's math.coffee function gimme_prime(x) returns xth prime number, , need use function in bunch of files.

so, essentially, how can reuse coffeescript code?

as requested op:

i commented might need module pattern, pointed him towards this article. take closer @ article myself, because @ first glance promising.

to sort-of restrict access functions module expose part of code, could pass objects files module's iife, , wrap files in iife, too. way, pass object , forth using global variable (sorry), assign undefined can.
since js processed top bottom, matter in order files linked page, , assign undefined global variable... same, @ point, module accessible other files, unless you're using lib of sorts, require global variable @ point


Comments

Popular posts from this blog

linux - Does gcc have any options to add version info in ELF binary file? -

android - send complex objects as post php java -

charts - What graph/dashboard product is facebook using in Dashboard: PUE & WUE -