Skip to content

Commit

Permalink
here we go
Browse files Browse the repository at this point in the history
  • Loading branch information
kaesetoast committed May 24, 2014
1 parent fffba9c commit ba95768
Show file tree
Hide file tree
Showing 7 changed files with 96 additions and 0 deletions.
13 changes: 13 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# http://editorconfig.org
root = true

[*]
indent_style = space
indent_size = 4
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true

[*.md]
trim_trailing_whitespace = false
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
node_modules
23 changes: 23 additions & 0 deletions bower.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"name": "customevent-polyfill",
"version": "1.0.0",
"homepage": "https://github.com/kaesetoast/customevent-polyfill",
"authors": [
"Philipp Nowinski <[email protected]>"
],
"description": "A polyfill for CustomEvent",
"main": "customevent-polyfill.js",
"keywords": [
"polyfill",
"customevent"
],
"license": "MIT",
"ignore": [
"**/.*",
"node_modules",
"bower_components",
"app/bower_components",
"test",
"tests"
]
}
25 changes: 25 additions & 0 deletions customevent-polyfill.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
(function () {
'use strict';
function CustomEvent (event, params) {
params = params || { bubbles: false, cancelable: false, detail: undefined };
var evt;
try {
evt = document.createEvent('CustomEvent');
evt.initCustomEvent(event, params.bubbles, params.cancelable, params.detail);
} catch (error) {
// fallback for browsers that don't support createEvent('CustomEvent')
evt = document.createEvent('Event');
for (var param in params) {
evt[param] = params[param];
}
evt.initEvent(event, params.bubbles, params.cancelable);
}
return evt;
}

if(typeof window.CustomEvent !== 'undefined') {
CustomEvent.prototype = window.CustomEvent.prototype;
}

window.CustomEvent = CustomEvent;
})();
1 change: 1 addition & 0 deletions customevent-polyfill.min.js

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

12 changes: 12 additions & 0 deletions gulpfile.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
'use strict';

var gulp = require('gulp'),
uglify = require('gulp-uglify'),
rename = require('gulp-rename');

gulp.task('compress', function() {
gulp.src('customevent-polyfill.js')
.pipe(uglify())
.pipe(rename('customevent-polyfill.min.js'))
.pipe(gulp.dest('.'));
});
21 changes: 21 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"name": "customevent-polyfill",
"version": "1.0.0",
"description": "A polyfill for CustomEvent",
"main": "customevent-polyfill.js",
"repository": {
"type": "git",
"url": "git://github.com/kaesetoast/customevent-polyfill.git"
},
"author": "Philipp Nowinski <[email protected]",
"license": "MIT",
"bugs": {
"url": "https://github.com/kaesetoast/customevent-polyfill/issues"
},
"homepage": "https://github.com/kaesetoast/customevent-polyfill",
"devDependencies": {
"gulp": "^3.6.2",
"gulp-rename": "^1.2.0",
"gulp-uglify": "^0.3.0"
}
}

0 comments on commit ba95768

Please sign in to comment.