Skip to content

Commit

Permalink
bugfix - widget sample
Browse files Browse the repository at this point in the history
  • Loading branch information
Alchemist85K committed Jul 19, 2018
1 parent 06ac1a8 commit b4b4176
Show file tree
Hide file tree
Showing 4 changed files with 109 additions and 90 deletions.
2 changes: 1 addition & 1 deletion web-widget/build/widget.SendBird.js

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions web-widget/package.json
Expand Up @@ -6,6 +6,7 @@
"scripts": {
"start-dev": "webpack-dev-server",
"start": "webpack -p && node server.js",
"build": "webpack -p",
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "SendBird",
Expand Down
14 changes: 6 additions & 8 deletions web-widget/src/js/elements/elements.js
Expand Up @@ -71,7 +71,7 @@ class Element {

_setClass(...args) {
args.reduce((target, classes) => {
return target.className += classes.join(' ');
return (target.className += classes.join(' '));
});
}

Expand Down Expand Up @@ -112,32 +112,31 @@ class Element {

_setClickEvent(...args) {
args.reduce((target, action) => {
target.addEventListener(this.eventName.CLICK, (e) => {
e.stopPropagation();
target.addEventListener(this.eventName.CLICK, () => {
action();
});
});
}

_setPasteEvent(...args) {
args.reduce((target, action) => {
target.addEventListener(this.eventName.PASTE, (event) => {
target.addEventListener(this.eventName.PASTE, event => {
action(event);
});
});
}

_setKeyupEvent(...args) {
args.reduce((target, action) => {
target.addEventListener(this.eventName.KEYUP, (event) => {
target.addEventListener(this.eventName.KEYUP, event => {
action(event);
});
});
}

_setKeydownEvent(...args) {
args.reduce((target, action) => {
target.addEventListener(this.eventName.KEYDOWN, (event) => {
target.addEventListener(this.eventName.KEYDOWN, event => {
action(event);
});
});
Expand All @@ -160,7 +159,7 @@ class Element {
}

_isBottom(target, list) {
return (target.scrollTop + target.offsetHeight) >= list.offsetHeight;
return target.scrollTop + target.offsetHeight >= list.offsetHeight;
}

enabledToggle(target, isEnabled) {
Expand All @@ -172,7 +171,6 @@ class Element {
target.style.cursor = styleValue.CURSOR_DEFAULT;
}
}

}

export { Element as default };

0 comments on commit b4b4176

Please sign in to comment.