Skip to content

Commit

Permalink
perf: calculate the appropriate text number
Browse files Browse the repository at this point in the history
  • Loading branch information
eddiewentw committed Nov 23, 2017
1 parent 0aaab79 commit 3c23595
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion src/js/appConfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,25 @@ deadlineTiming.setMinutes(0);
deadlineTiming.setSeconds(0, 0);

/* eslint-disable max-len */
export const catTypeing = 'aljjjgaaaaaaaaaaaaaaaaaaaaaaam,32;iop9gy7uk/lm;\\\\\\\\\\\\\\\\\\\\\\\\\\aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaayyyyyyyy................s@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@iooooooooooooooooooooooooooooooooooooooifffffffffffffffffffffffffffffff';
const defaultTypingText = 'aljjjgaaaaaaaaaaaaaaaaaaaaaaam,32;iop9gy7uk/lm;\\\\\\\\\\\\\\\\\\\\\\\\\\aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaayyyyyyyy................s@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ioooooooooooooooooooooooooooooooooooooifffffffffffffffffffffffffffffffo23orl;wef;p34io3m23ihcdusihcowefdfnbdjewd';
/* eslint-enable max-len */

const textWidth = 48;
const textHeight = 92;

const totalTextNumber = Math.floor(window.innerWidth / textWidth) *
(
window.innerHeight % textHeight === 0 ?
window.innerHeight / textHeight
:
Math.floor(window.innerHeight / textHeight) + 1
);

export const catTyping = totalTextNumber < defaultTypingText.length ?
defaultTypingText.substr(0, totalTextNumber)
:
`${defaultTypingText}${'y'.repeat(totalTextNumber - defaultTypingText.length)}`;

export const timer = {
days: 0,
hours: 0,
Expand Down

0 comments on commit 3c23595

Please # to comment.