Commit 88e12ac9 authored by Mike Greiling's avatar Mike Greiling

revert removal of requestAnimationFrame and move to a separate MR/discussion

parent a2a276a8
...@@ -6,6 +6,10 @@ import * as Emoji from './emoji'; ...@@ -6,6 +6,10 @@ import * as Emoji from './emoji';
const animationEndEventString = 'animationend webkitAnimationEnd MSAnimationEnd oAnimationEnd'; const animationEndEventString = 'animationend webkitAnimationEnd MSAnimationEnd oAnimationEnd';
const transitionEndEventString = 'transitionend webkitTransitionEnd oTransitionEnd MSTransitionEnd'; 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 const FROM_SENTENCE_REGEX = /(?:, and | and |, )/; // For separating lists produced by ruby's Array#toSentence
...@@ -46,7 +50,9 @@ export default class AwardsHandler { ...@@ -46,7 +50,9 @@ export default class AwardsHandler {
this.registerEventListener('one', $(document), 'mouseenter focus', '.js-add-award', 'mouseenter focus', () => { this.registerEventListener('one', $(document), 'mouseenter focus', '.js-add-award', 'mouseenter focus', () => {
const $menu = $('.emoji-menu'); const $menu = $('.emoji-menu');
if ($menu.length === 0) { if ($menu.length === 0) {
setTimeout(() => this.createEmojiMenu()); requestAnimationFrame(() => {
this.createEmojiMenu();
});
} }
}); });
this.registerEventListener('on', $(document), 'click', '.js-add-award', (e) => { this.registerEventListener('on', $(document), 'click', '.js-add-award', (e) => {
...@@ -189,7 +195,7 @@ export default class AwardsHandler { ...@@ -189,7 +195,7 @@ export default class AwardsHandler {
categoryLabelMap[categoryNameKey], categoryLabelMap[categoryNameKey],
emojisInCategory, emojisInCategory,
); );
setTimeout(() => { requestAnimationFrame(() => {
emojiContentElement.insertAdjacentHTML('beforeend', categoryMarkup); emojiContentElement.insertAdjacentHTML('beforeend', categoryMarkup);
resolve(); resolve();
}); });
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment