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
Post a Comment