Skip to content

Commit fac2974

Browse files
author
Gaëtan Renaudeau
committed
require ify the lib
1 parent 1a8c31c commit fac2974

File tree

3 files changed

+35
-22
lines changed

3 files changed

+35
-22
lines changed

bower.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
22
"name": "glsl.js",
3-
"version": "1.0.0",
3+
"version": "1.0.1",
44
"main": "glsl.js"
55
}

glsl.js

+16-3
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,17 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1414
See the License for the specific language governing permissions and
1515
limitations under the License.
1616
*/
17-
(function () {
17+
(function (definition) {
18+
if (typeof exports === "object") {
19+
module.exports = definition();
20+
}
21+
else if (typeof define === "function" && define.amd) {
22+
define(definition);
23+
}
24+
else {
25+
window.Glsl = definition();
26+
}
27+
})(function () {
1828

1929
var requiredOptions = ["fragment", "canvas", "variables"];
2030

@@ -77,7 +87,7 @@ limitations under the License.
7787
*
7888
* @namespace
7989
*/
80-
this.Glsl = function (options) {
90+
var Glsl = function (options) {
8191
if ( !(this instanceof arguments.callee) ) return new arguments.callee(options);
8292
if (!options) throw new Error("Glsl: {"+requiredOptions+"} are required.");
8393
for (var i=0; i<requiredOptions.length; i++)
@@ -633,6 +643,7 @@ limitations under the License.
633643
}
634644
}
635645

646+
// FIXME: following polyfill should be out of the lib
636647
// http://paulirish.com/2011/requestanimationframe-for-smart-animating/
637648
// http://my.opera.com/emoller/blog/2011/12/20/requestanimationframe-for-smart-er-animating
638649

@@ -664,4 +675,6 @@ limitations under the License.
664675
};
665676
}());
666677

667-
}());
678+
return Glsl;
679+
680+
});

glsl.min.js

+18-18
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)