Permalink
Browse files

Merge pull request #15 from flatiron/gh-examples

Examples cleanup
  • Loading branch information...
2 parents 20d952b + 83b9186 commit 1e4954772876f722ed66b970bf918b9bca609da2 Paolo Fragomeni committed Jan 18, 2012
View
@@ -1,2 +1,4 @@
node_modules
-npm-debug.log
+npm-debug.log
+.DS_Store
+
View
Binary file not shown.
View
@@ -0,0 +1,12 @@
+
+var app = new App();
+
+app.use(HelloWorld, { "delimiter": "!" } );
+
+app.init(function (err) {
+ if (err) {
+ console.log(err);
+ }
+});
+
+app.hello("world");
@@ -1,19 +1,11 @@
<html>
<head>
- <script type="text/javascript" src="broadway.js"></script>
- <script type="text/javascript" src="plugins/helloworld.js"></script>
+ <title>Example</title>
</head>
<body>
- <script type="text/javascript">
- var app = new App();
-
- app.use(HelloWorld, { "delimiter": "!" } );
- app.init(function (err) {
- if (err) console.log(err);
- });
-
- app.hello("world");
- </script>
+ <script type="text/javascript" src="broadway.js"></script>
+ <script type="text/javascript" src="plugins/helloworld.js"></script>
+ <script type="text/javascript" src="index.js"></script>
</body>
</html>
@@ -1,15 +1,23 @@
-(function (exports) {
- exports.HelloWorld = {
- // `exports.attach` gets called by broadway on `app.use`
- attach: function (options) {
- this.hello = function (world) {
- console.log("Hello "+ world + options.delimiter || ".");
- }
- },
- // `exports.init` gets called by broadway on `app.init`.
- init: function (done) {
- // This plugin doesn't require any initialization step.
- return done();
- }
- };
-}(window));
+
+window.HelloWorld = {};
+
+//
+// `exports.attach` gets called by broadway on `app.use`
+//
+HelloWorld.attach = function (options) {
+
+ this.hello = function (world) {
+ console.log("Hello "+ world + options.delimiter || ".");
+ }
+};
+
+//
+// `exports.init` gets called by broadway on `app.init`.
+//
+HelloWorld.init = function (done) {
+
+ //
+ // This plugin doesn't require any initialization step.
+ //
+ return done();
+};
@@ -1,6 +1,5 @@
-var broadway = require("broadway");
-var app = new broadway.App();
+var app = new (require("broadway").App)();
// Passes the second argument to `helloworld.attach`.
app.use(require("./plugins/helloworld"), { "delimiter": "!" } );
@@ -1,16 +1,23 @@
+
+var HelloWorld = exports;
+
+//
// `exports.attach` gets called by broadway on `app.use`
-exports.attach = function (options) {
+//
+HelloWorld.attach = function (options) {
this.hello = function (world) {
console.log("Hello "+ world + options.delimiter || ".");
}
-
};
+//
// `exports.init` gets called by broadway on `app.init`.
-exports.init = function (done) {
+//
+HelloWorld.init = function (done) {
+ //
// This plugin doesn't require any initialization step.
+ //
return done();
-
};
View
@@ -4,14 +4,15 @@
"author": "Nodejitsu Inc. <info@nodejitsu.com>",
"version": "0.1.7",
"contributors": [
- { "name": "Charlie Robbins", "email": "charlie@nodejitsu.com" }
+ { "name": "Charlie Robbins", "email": "charlie@nodejitsu.com" },
+ { "name": "Paolo Fragomeni", "email": "paolo@nodejitsu.com" }
],
"repository": {
"type": "git",
"url": "http://github.com/flatiron/broadway.git"
},
"dependencies": {
- "eventemitter2": "0.4.1",
+ "eventemitter2": "0.4.3",
"nconf": "0.5.1",
"optimist": "0.3.1",
"winston": "0.5.9",

0 comments on commit 1e49547

Please sign in to comment.