Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

[dist] Browserify build for frontend

  • Loading branch information...
commit 8bd3cfbc30ef7bf5a06a00d9eda46f4e40291b71 1 parent f658ae0
@pksunkara pksunkara authored
Showing with 22 additions and 9 deletions.
  1. +3 −0  lib/browser.js
  2. +18 −9 lib/resourceful/engines.js
  3. +1 −0  package.json
View
3  lib/browser.js
@@ -0,0 +1,3 @@
+window.resourceful = require('./resourceful');
+
+require('./resourceful/engines/memory');
View
27 lib/resourceful/engines.js
@@ -12,14 +12,23 @@ var fs = require('fs'),
var engines = exports;
-//
-// Setup all engines as lazy-loaded getters.
-//
-fs.readdirSync(path.join(__dirname, 'engines')).forEach(function (file) {
- var engine = file.replace('.js', ''),
- name = common.capitalize(engine);
+if (fs.readdirSync) {
+ // Backend - Setup all engines as lazy-loaded getters.
+ fs.readdirSync(path.join(__dirname, 'engines')).forEach(function (file) {
+ var engine = file.replace('.js', ''),
+ name = common.capitalize(engine);
- engines.__defineGetter__(name, function () {
- return require('./engines/' + engine)[name];
+ engines.__defineGetter__(name, function () {
+ return require('./engines/' + engine)[name];
+ });
});
-});
+} else {
+ // Frontend support for engines
+ ['memory'].forEach(function (engine) {
+ var name = common.capitalize(engine);
+
+ engines.__defineGetter__(name, function () {
+ return require(path.resolve(__dirname, './engines/', engine))[name];
+ });
+ });
+}
View
1  package.json
@@ -23,6 +23,7 @@
},
"main": "./lib/resourceful",
"scripts": {
+ "browserify": "browserify lib/browser.js -o build/resourceful.js",
"test": "vows --spec -i"
}
}
Please sign in to comment.
Something went wrong with that request. Please try again.