Skip to content

Commit

Permalink
Its Gulp Time
Browse files Browse the repository at this point in the history
  • Loading branch information
kenwheeler committed Feb 23, 2014
1 parent 6f12a10 commit 8eb3e85
Show file tree
Hide file tree
Showing 8 changed files with 65 additions and 14 deletions.
5 changes: 3 additions & 2 deletions dispatch.js
Expand Up @@ -28,12 +28,13 @@
};

// Initialize event w/ name
//(mocha-phantomjs doesn't support Event constructor)
e.ev.initEvent(event,true, true);

// Update method for data
e.fnc = function(){
return(fn.call(e.ev, e.data));
}
};

// Adds event object to global event array
dispatch.events[event] = e;
Expand Down Expand Up @@ -89,7 +90,7 @@
} else {
dispatch.global.fireEvent(e.ev);
}
}
};

// Return dispatch object
return dispatch;
Expand Down
6 changes: 3 additions & 3 deletions docs/dispatch.html
Expand Up @@ -297,7 +297,7 @@ <h5>Parameters:</h5>

<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="dispatch.js.html">dispatch.js</a>, <a href="dispatch.js.html#line46">line 46</a>
<a href="dispatch.js.html">dispatch.js</a>, <a href="dispatch.js.html#line50">line 50</a>
</li></ul></dd>


Expand Down Expand Up @@ -577,7 +577,7 @@ <h5>Parameters:</h5>

<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="dispatch.js.html">dispatch.js</a>, <a href="dispatch.js.html#line68">line 68</a>
<a href="dispatch.js.html">dispatch.js</a>, <a href="dispatch.js.html#line72">line 72</a>
</li></ul></dd>


Expand Down Expand Up @@ -624,7 +624,7 @@ <h2><a href="index.html">Index</a></h2><h3>Namespaces</h3><ul><li><a href="dispa
<br clear="both">

<footer>
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.3.0-alpha4</a> on Sun Feb 23 2014 08:25:41 GMT-0500 (EST)
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.3.0-alpha4</a> on Sun Feb 23 2014 11:49:56 GMT-0500 (EST)
</footer>

<script> prettyPrint(); </script>
Expand Down
12 changes: 8 additions & 4 deletions docs/dispatch.js.html
Expand Up @@ -49,15 +49,19 @@ <h1 class="page-title">Source: dispatch.js</h1>
dispatch.on = function(event, fn){
// Creates object to store event data in
var e = {
ev: new Event(event),
ev: document.createEvent('Event'),
fnc: fn,
data: null
};

// Initialize event w/ name
//(mocha-phantomjs doesn't support Event constructor)
e.ev.initEvent(event,true, true);

// Update method for data
e.fnc = function(){
return(fn.call(e.ev, e.data));
}
};

// Adds event object to global event array
dispatch.events[event] = e;
Expand Down Expand Up @@ -113,7 +117,7 @@ <h1 class="page-title">Source: dispatch.js</h1>
} else {
dispatch.global.fireEvent(e.ev);
}
}
};

// Return dispatch object
return dispatch;
Expand All @@ -134,7 +138,7 @@ <h2><a href="index.html">Index</a></h2><h3>Namespaces</h3><ul><li><a href="dispa
<br clear="both">

<footer>
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.3.0-alpha4</a> on Sun Feb 23 2014 08:25:41 GMT-0500 (EST)
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.3.0-alpha4</a> on Sun Feb 23 2014 11:49:56 GMT-0500 (EST)
</footer>

<script> prettyPrint(); </script>
Expand Down
2 changes: 1 addition & 1 deletion docs/index.html
Expand Up @@ -54,7 +54,7 @@ <h2><a href="index.html">Index</a></h2><h3>Namespaces</h3><ul><li><a href="dispa
<br clear="both">

<footer>
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.3.0-alpha4</a> on Sun Feb 23 2014 08:25:41 GMT-0500 (EST)
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.3.0-alpha4</a> on Sun Feb 23 2014 11:49:56 GMT-0500 (EST)
</footer>

<script> prettyPrint(); </script>
Expand Down
39 changes: 39 additions & 0 deletions gulpfile.js
@@ -0,0 +1,39 @@
var gulp = require('gulp');

// Plugins
var jshint = require('gulp-jshint');
var concat = require('gulp-concat');
var uglify = require('gulp-uglify');
var rename = require('gulp-rename');
var jsdoc = require("gulp-jsdoc");

// Lint Task
gulp.task('lint', function() {
return gulp.src('dispatch.js')
.pipe(jshint())
.pipe(jshint.reporter('default'));
});

// Docs Task
gulp.task('docs', function() {
gulp.src("dispatch.js")
.pipe(jsdoc('./docs'));
});

// Concatenate & Minify JS
gulp.task('scripts', function() {
return gulp.src('dispatch.js')
.pipe(concat('dispatch.js'))
.pipe(gulp.dest('src'))
.pipe(rename('dispatch.min.js'))
.pipe(uglify())
.pipe(gulp.dest('src'));
});

// Watch Files For Changes
gulp.task('watch', function() {
gulp.watch('dispatch.js', ['lint', 'docs', 'scripts']);
});

// Default Task
gulp.task('default', ['lint', 'scripts', 'docs', 'watch']);
8 changes: 7 additions & 1 deletion package.json
Expand Up @@ -4,7 +4,13 @@
"devDependencies": {
"chai": "~1.9.0",
"mocha": "~1.17.1",
"mocha-phantomjs": "~3.3.2"
"mocha-phantomjs": "~3.3.2",
"gulp": "~3.5.2",
"gulp-jshint": "~1.4.2",
"gulp-concat": "~2.1.7",
"gulp-uglify": "~0.2.1",
"gulp-rename": "~1.1.0",
"gulp-jsdoc": "0.0.2"
},
"engines": {
"node": "0.8.x",
Expand Down
5 changes: 3 additions & 2 deletions src/dispatch.js
Expand Up @@ -28,12 +28,13 @@
};

// Initialize event w/ name
//(mocha-phantomjs doesn't support Event constructor)
e.ev.initEvent(event,true, true);

// Update method for data
e.fnc = function(){
return(fn.call(e.ev, e.data));
}
};

// Adds event object to global event array
dispatch.events[event] = e;
Expand Down Expand Up @@ -89,7 +90,7 @@
} else {
dispatch.global.fireEvent(e.ev);
}
}
};

// Return dispatch object
return dispatch;
Expand Down
2 changes: 1 addition & 1 deletion src/dispatch.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 8eb3e85

Please sign in to comment.