Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
UMD (amd, common.js, window)
;(function(define){define(function(require,exports,module){
//...
});})(typeof define=='function'&&define.amd?define
:(function(n,w){'use strict';return typeof module=='object'?function(c){
c(require,exports,module);}:function(c){var m={exports:{}};c(function(n){
return w[n];},m.exports,m);w[n]=m.exports;};})('module-name',this));
@jrburke

This comment has been minimized.

Copy link

@jrburke jrburke commented Jan 24, 2014

This will likely not work for static analysis build tools for AMD, where they look for a function literal passed to define() to parse for the commonjs sugar syntax.

@wilsonpage

This comment has been minimized.

Copy link
Owner Author

@wilsonpage wilsonpage commented Jan 24, 2014

Ah, thanks for the feedback @jrburke! Which tools, like r.js? Can you suggest improvements?

@jrburke

This comment has been minimized.

Copy link

@jrburke jrburke commented Jan 25, 2014

Yes, r.js would be one, but i can see others, just hard to account for all possible patterns otherwise. The umdjs/umd ones were designed to thread all the issues.

@timdream

This comment has been minimized.

Copy link

@timdream timdream commented Jan 25, 2014

I wonder if you need to check for define.amd === true on line 6?

@wilsonpage

This comment has been minimized.

Copy link
Owner Author

@wilsonpage wilsonpage commented Jan 25, 2014

@jrburke revised version. Not as pretty, but still nice to have the junk at the bottom I think :) Thought?

@jrburke

This comment has been minimized.

Copy link

@jrburke jrburke commented Jan 25, 2014

@wilsonpage, looks like it should work now. This one requires two levels of code indent for people that like to indent for each brace body. For some people that compromises more on usable space than having the stuff at the top. So, it is down to person choice.

As @timdream suggests, I would do typeof define=='function' && define.amd for the AMD define check, to avoid possible conflicts with another define on the page.

@jlettvin

This comment has been minimized.

Copy link

@jlettvin jlettvin commented Oct 4, 2015

After some experiments with ftcolumnflow, I have some observations and a recommendation.
I have a github project implementing markup for scientific paper writing. For this project,
a principle value of this ftcolumnflow is an ability to print documents reliably on 8.5"x11" paper.
Multi-column multi-page flow is very valuable, and you have done a great job of achieving this.
One remaining challenge is to output a page break just before horizontal red outlines after the first.
I would like your help.

I have spent a couple of days experimenting with page sizes and modifications to your code.
In Chrome Browser 1090x1470 is close, but the red boundary creeps up to the previous page
from being on the next page by page 34 of print preview. In Safari, 1090x1468 had no creep
by page 129. Experiments with Firefox were incomplete so far.

Some code modifications I tried included CSS page-break-before, but those all fail because
You ingest the text hidden and rewrite it into your cf-pages. Beautiful, but refractory to breaks.
I am happy to adjust the size of the red outline, but during my experiments I found that
sometimes the text overlaps the outline.

Is there any advice you can give me? I will continue experimenting.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.