summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Greiling <mike@pixelcog.com>2017-06-27 04:24:08 -0500
committerMike Greiling <mike@pixelcog.com>2017-06-27 08:51:52 -0500
commit88e12ac94b13bc4ee57a60adca64af5cf7d14030 (patch)
treeb3d4608a3a8c35e8b44ba28aa36702a038c32e85
parenta2a276a81509b9093087dcb7b6eb1cbed7c41e79 (diff)
downloadgitlab-ce-refactor-emoji-utils.tar.gz
revert removal of requestAnimationFrame and move to a separate MR/discussionrefactor-emoji-utils
-rw-r--r--app/assets/javascripts/awards_handler.js10
1 files changed, 8 insertions, 2 deletions
diff --git a/app/assets/javascripts/awards_handler.js b/app/assets/javascripts/awards_handler.js
index f0ccbc4b998..c34d80f0601 100644
--- a/app/assets/javascripts/awards_handler.js
+++ b/app/assets/javascripts/awards_handler.js
@@ -6,6 +6,10 @@ import * as Emoji from './emoji';
const animationEndEventString = 'animationend webkitAnimationEnd MSAnimationEnd oAnimationEnd';
const transitionEndEventString = 'transitionend webkitTransitionEnd oTransitionEnd MSTransitionEnd';
+const requestAnimationFrame = window.requestAnimationFrame ||
+ window.webkitRequestAnimationFrame ||
+ window.mozRequestAnimationFrame ||
+ window.setTimeout;
const FROM_SENTENCE_REGEX = /(?:, and | and |, )/; // For separating lists produced by ruby's Array#toSentence
@@ -46,7 +50,9 @@ export default class AwardsHandler {
this.registerEventListener('one', $(document), 'mouseenter focus', '.js-add-award', 'mouseenter focus', () => {
const $menu = $('.emoji-menu');
if ($menu.length === 0) {
- setTimeout(() => this.createEmojiMenu());
+ requestAnimationFrame(() => {
+ this.createEmojiMenu();
+ });
}
});
this.registerEventListener('on', $(document), 'click', '.js-add-award', (e) => {
@@ -189,7 +195,7 @@ export default class AwardsHandler {
categoryLabelMap[categoryNameKey],
emojisInCategory,
);
- setTimeout(() => {
+ requestAnimationFrame(() => {
emojiContentElement.insertAdjacentHTML('beforeend', categoryMarkup);
resolve();
});