tbranyen/use.js — pull request #11 by christophercurrie (2012-04-04 18:38:04+00:00)
Title: Add support for wrap=true in r.js

When wrap=true is used in r.js, the entire processed output is wrapped in an anonymous function. In this case, libraries that do not explicitly add themselves to the global object, but instead rely on declaring a variable in the current scope and assume that it's global, are not picked up by the 'window[attach]' expression.

This patch tests for the existence of the attach string as a valid expression, and returns the value of the expression if it's defined. Tested using r.js 1.7 and Kinetic.js.