From 0cfe10f0811f11540b1cd524a492cc63e1a7e6f1 Mon Sep 17 00:00:00 2001 From: David Lu Date: Sun, 21 Aug 2016 15:19:55 -0400 Subject: [PATCH 1/2] use umd adds compatibility for node, amd, and globals --- whammy.js | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/whammy.js b/whammy.js index 209a684..5620149 100644 --- a/whammy.js +++ b/whammy.js @@ -4,7 +4,15 @@ vid.compile() */ -window.Whammy = (function(){ +(function (root, factory) { + if (typeof define === 'function' && define.amd) { + define([], factory); + } else if (typeof module === 'object' && module.exports) { + module.exports = factory(); + } else { + root.Whammy = factory(); + } +}(this, function () { // in this case, frames has a very specific meaning, which will be // detailed once i finish writing the code @@ -554,7 +562,7 @@ window.Whammy = (function(){ return webp; }), outputAsArray); callback(webm); - + }.bind(this)); }; @@ -570,4 +578,4 @@ window.Whammy = (function(){ toWebM: toWebM // expose methods of madness } -})() +})) From 39d5babf090e339bc4dabc72e5b5c7f2d82dfffc Mon Sep 17 00:00:00 2001 From: David Lu Date: Sun, 21 Aug 2016 15:22:16 -0400 Subject: [PATCH 2/2] add package.json --- package.json | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 package.json diff --git a/package.json b/package.json new file mode 100644 index 0000000..d7a2dc5 --- /dev/null +++ b/package.json @@ -0,0 +1,31 @@ +{ + "name": "whammy", + "version": "0.0.1", + "description": "Real-time Javascript Video Encoder", + "main": "whammy.js", + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/antimatter15/whammy.git" + }, + "keywords": [ + "video", + "encoding", + "vp8", + "webm", + "ebml", + "riff", + "webp", + "codec", + "browser", + "chrome" + ], + "author": "", + "license": "MIT", + "bugs": { + "url": "https://github.com/antimatter15/whammy/issues" + }, + "homepage": "https://github.com/antimatter15/whammy#readme" +}