Skip to content
This repository has been archived by the owner on Jun 11, 2024. It is now read-only.

Commit

Permalink
[Prerelease] Bumped version number
Browse files Browse the repository at this point in the history
  • Loading branch information
Wikiki committed May 11, 2018
1 parent bb57556 commit cc66ee4
Show file tree
Hide file tree
Showing 7 changed files with 10 additions and 141 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
<a name="2.0.7"></a>
## [2.0.7](https://github.com/Wikiki/bulma-carousel/compare/2.0.6...2.0.7) (2018-05-11)



<a name="2.0.6"></a>
## [2.0.6](https://github.com/Wikiki/bulma-carousel/compare/2.0.5...2.0.6) (2018-05-11)

Expand Down
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "bulma-carousel",
"description": "Display a Image / Content carousel",
"main": "carousel.sass",
"version": "2.0.6",
"version": "2.0.7",
"authors": [
"Wikiki <[email protected]> (https://wikiki.github.io/bulma-extensions/overview)"
],
Expand Down
136 changes: 0 additions & 136 deletions dist/bulma-carousel.js
Original file line number Diff line number Diff line change
Expand Up @@ -130,142 +130,6 @@ class EventEmitter {
}
}

return EventEmitter;

})));

(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
typeof define === 'function' && define.amd ? define('bulmaCarousel', factory) :
(global.bulmaCarousel = factory());
}(this, (function () { 'use strict';

class EventEmitter {
constructor(listeners = []) {
this._listeners = new Map(listeners);
this._middlewares = new Map();
}

listenerCount(eventName) {
if (!this._listeners.has(eventName)) {
return 0;
}

const eventListeners = this._listeners.get(eventName);
return eventListeners.length;
}

removeListeners(eventName = null, middleware = false) {
if (eventName !== null) {
if (Array.isArray(eventName)) {
name.forEach(e => this.removeListeners(e, middleware));
} else {
this._listeners.delete(eventName);

if (middleware) {
this.removeMiddleware(eventName);
}
}
} else {
this._listeners = new Map();
}
}

middleware(eventName, fn) {
if (Array.isArray(eventName)) {
name.forEach(e => this.middleware(e, fn));
} else {
if (!Array.isArray(this._middlewares.get(eventName))) {
this._middlewares.set(eventName, []);
}

(this._middlewares.get(eventName)).push(fn);
}
}

removeMiddleware(eventName = null) {
if (eventName !== null) {
if (Array.isArray(eventName)) {
name.forEach(e => this.removeMiddleware(e));
} else {
this._middlewares.delete(eventName);
}
} else {
this._middlewares = new Map();
}
}

on(name, callback, once = false) {
if (Array.isArray(name)) {
name.forEach(e => this.on(e, callback));
} else {
name = name.toString();
const split = name.split(/,|, | /);

if (split.length > 1) {
split.forEach(e => this.on(e, callback));
} else {
if (!Array.isArray(this._listeners.get(name))) {
this._listeners.set(name, []);
}

(this._listeners.get(name)).push({once: once, callback: callback});
}
}
}

once(name, callback) {
this.on(name, callback, true);
}

emit(name, data, silent = false) {
name = name.toString();
let listeners = this._listeners.get(name);
let middlewares = null;
let doneCount = 0;
let execute = silent;

if (Array.isArray(listeners)) {
listeners.forEach((listener, index) => {
// Start Middleware checks unless we're doing a silent emit
if (!silent) {
middlewares = this._middlewares.get(name);
// Check and execute Middleware
if (Array.isArray(middlewares)) {
middlewares.forEach(middleware => {
middleware(data, (newData = null) => {
if (newData !== null) {
data = newData;
}
doneCount++;
}, name);
});

if (doneCount >= middlewares.length) {
execute = true;
}
} else {
execute = true;
}
}

// If Middleware checks have been passed, execute
if (execute) {
if (listener.once) {
listeners[index] = null;
}
listener.callback(data);
}
});

// Dirty way of removing used Events
while (listeners.indexOf(null) !== -1) {
listeners.splice(listeners.indexOf(null), 1);
}
}
}
}

class Carousel extends EventEmitter {
constructor(selector) {
super();
Expand Down
2 changes: 1 addition & 1 deletion dist/bulma-carousel.min.js

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

2 changes: 1 addition & 1 deletion gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ gulp.task('clean:styles', function() {
// appropriate location.
gulp.task('build:scripts', function() {
return gulp
.src([paths.src + paths.jsPattern])
.src([paths.src + mainJsFile])
.pipe(rollup({
plugins: [babel({
babelrc: false,
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "bulma-carousel",
"version": "2.0.6",
"version": "2.0.7",
"description": "Display a Image / Content carousel",
"main": "dist/bulma-carousel.sass",
"scripts": {
Expand Down
2 changes: 1 addition & 1 deletion src/extension.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ export default class Carousel extends EventEmitter {
img.onload = () => {
this.carouselContainer.style.height = img.naturalWidth + 'px';
}
};
}

this.currentItem = {
carousel: this.carousel,
Expand Down

0 comments on commit cc66ee4

Please sign in to comment.