mirror of
https://github.com/Sped0n/bridget.git
synced 2026-04-18 12:09:29 -07:00
change function style to const
This commit is contained in:
@@ -87,7 +87,7 @@ async function enterOverlay(): Promise<void> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// initialization
|
// initialization
|
||||||
export function trackMouseInit(): void {
|
export const trackMouseInit = (): void => {
|
||||||
window.addEventListener('mousemove', handleOnMove)
|
window.addEventListener('mousemove', handleOnMove)
|
||||||
layers[4].addEventListener(
|
layers[4].addEventListener(
|
||||||
'click',
|
'click',
|
||||||
@@ -100,12 +100,12 @@ export function trackMouseInit(): void {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
export function globalIndexDec(): void {
|
export const globalIndexDec = (): void => {
|
||||||
globalIndex--
|
globalIndex--
|
||||||
preloader(globalIndex)
|
preloader(globalIndex)
|
||||||
}
|
}
|
||||||
|
|
||||||
export function globalIndexInc(): void {
|
export const globalIndexInc = (): void => {
|
||||||
globalIndex++
|
globalIndex++
|
||||||
preloader(globalIndex)
|
preloader(globalIndex)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import { preloadImage, calcImageIndex } from './utils'
|
|||||||
|
|
||||||
let lastIndex: number = 0
|
let lastIndex: number = 0
|
||||||
|
|
||||||
export function preloader(index: number): void {
|
export const preloader = (index: number): void => {
|
||||||
if (lastIndex === index) {
|
if (lastIndex === index) {
|
||||||
for (let i: number = -2; i <= 1; i++)
|
for (let i: number = -2; i <= 1; i++)
|
||||||
preloadImage(imagesArray[calcImageIndex(index + i, imagesArrayLen)].url)
|
preloadImage(imagesArray[calcImageIndex(index + i, imagesArrayLen)].url)
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import { duper } from './utils'
|
import { duper } from './utils'
|
||||||
|
|
||||||
// update index of displaying image
|
// update index of displaying image
|
||||||
export function imgIndexSpanUpdate(numOne: number, numTwo: number): void {
|
export const imgIndexSpanUpdate = (numOne: number, numTwo: number): void => {
|
||||||
// footer index number display module
|
// footer index number display module
|
||||||
const footerIndexDisp = document.getElementsByClassName('ftid')
|
const footerIndexDisp = document.getElementsByClassName('ftid')
|
||||||
const numOneString: string = duper(numOne)
|
const numOneString: string = duper(numOne)
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ import { vwRefreshInit } from './overlay'
|
|||||||
import { preloader } from './imageCache'
|
import { preloader } from './imageCache'
|
||||||
import { getDeviceType } from './utils'
|
import { getDeviceType } from './utils'
|
||||||
|
|
||||||
function desktopInit(): void {
|
const desktopInit = (): void => {
|
||||||
preloader(0)
|
preloader(0)
|
||||||
vwRefreshInit()
|
vwRefreshInit()
|
||||||
imgIndexSpanUpdate(0, imagesArrayLen)
|
imgIndexSpanUpdate(0, imagesArrayLen)
|
||||||
@@ -14,7 +14,7 @@ function desktopInit(): void {
|
|||||||
trackMouseInit()
|
trackMouseInit()
|
||||||
}
|
}
|
||||||
|
|
||||||
function mobileInit(): void {
|
const mobileInit = (): void => {
|
||||||
console.log('mobile')
|
console.log('mobile')
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ const cursor = document
|
|||||||
.item(0) as HTMLDivElement
|
.item(0) as HTMLDivElement
|
||||||
|
|
||||||
// set cursor text
|
// set cursor text
|
||||||
function setCursorText(text: string): void {
|
const setCursorText = (text: string): void => {
|
||||||
cursor.innerText = text
|
cursor.innerText = text
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -39,7 +39,7 @@ const overlayCursor = (e: MouseEvent): void => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// disable listeners
|
// disable listeners
|
||||||
function disableListener(): void {
|
const disableListener = (): void => {
|
||||||
window.removeEventListener('mousemove', overlayCursor)
|
window.removeEventListener('mousemove', overlayCursor)
|
||||||
closeSection = removeAllEventListeners(closeSection)
|
closeSection = removeAllEventListeners(closeSection)
|
||||||
prevSection = removeAllEventListeners(prevSection)
|
prevSection = removeAllEventListeners(prevSection)
|
||||||
@@ -47,13 +47,13 @@ function disableListener(): void {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// enable overlay
|
// enable overlay
|
||||||
export function overlayEnable(): void {
|
export const overlayEnable = (): void => {
|
||||||
overlay.style.zIndex = '7'
|
overlay.style.zIndex = '7'
|
||||||
setListener()
|
setListener()
|
||||||
}
|
}
|
||||||
|
|
||||||
// disable overlay
|
// disable overlay
|
||||||
export function overlayDisable(): void {
|
export const overlayDisable = (): void => {
|
||||||
overlay.style.zIndex = '-1'
|
overlay.style.zIndex = '-1'
|
||||||
setCursorText('')
|
setCursorText('')
|
||||||
disableListener()
|
disableListener()
|
||||||
@@ -76,14 +76,14 @@ async function handleCloseClick(): Promise<void> {
|
|||||||
window.addEventListener('mousemove', handleOnMove)
|
window.addEventListener('mousemove', handleOnMove)
|
||||||
}
|
}
|
||||||
|
|
||||||
function handlePrevClick(): void {
|
const handlePrevClick = (): void => {
|
||||||
globalIndexDec()
|
globalIndexDec()
|
||||||
const imgIndex = calcImageIndex(globalIndex, imagesArrayLen)
|
const imgIndex = calcImageIndex(globalIndex, imagesArrayLen)
|
||||||
FIFO(createImgElement(imagesArray[imgIndex], false).image, layers)
|
FIFO(createImgElement(imagesArray[imgIndex], false).image, layers)
|
||||||
imgIndexSpanUpdate(imgIndex + 1, imagesArrayLen)
|
imgIndexSpanUpdate(imgIndex + 1, imagesArrayLen)
|
||||||
}
|
}
|
||||||
|
|
||||||
function handleNextClick(): void {
|
const handleNextClick = (): void => {
|
||||||
globalIndexInc()
|
globalIndexInc()
|
||||||
const imgIndex = calcImageIndex(globalIndex, imagesArrayLen)
|
const imgIndex = calcImageIndex(globalIndex, imagesArrayLen)
|
||||||
FIFO(createImgElement(imagesArray[imgIndex], false).image, layers)
|
FIFO(createImgElement(imagesArray[imgIndex], false).image, layers)
|
||||||
@@ -91,7 +91,7 @@ function handleNextClick(): void {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// set event listener
|
// set event listener
|
||||||
function setListener(): void {
|
const setListener = (): void => {
|
||||||
window.addEventListener('mousemove', overlayCursor, { passive: true })
|
window.addEventListener('mousemove', overlayCursor, { passive: true })
|
||||||
closeSection.addEventListener(
|
closeSection.addEventListener(
|
||||||
'mouseover',
|
'mouseover',
|
||||||
@@ -137,7 +137,7 @@ function setListener(): void {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
export function vwRefreshInit(): void {
|
export const vwRefreshInit = (): void => {
|
||||||
window.addEventListener(
|
window.addEventListener(
|
||||||
'resize',
|
'resize',
|
||||||
() => {
|
() => {
|
||||||
|
|||||||
@@ -9,12 +9,12 @@ export const thresholdSensitivityArray: number[] = [100, 40, 18, 14, 9, 5]
|
|||||||
export let thresholdIndex: number = 2
|
export let thresholdIndex: number = 2
|
||||||
|
|
||||||
// update inner text of threshold display element
|
// update inner text of threshold display element
|
||||||
function thresholdUpdate(): void {
|
const thresholdUpdate = (): void => {
|
||||||
thresholdDisp.innerText = duper(threshold[thresholdIndex])
|
thresholdDisp.innerText = duper(threshold[thresholdIndex])
|
||||||
}
|
}
|
||||||
|
|
||||||
// threshold control initialization
|
// threshold control initialization
|
||||||
export function thresholdCtlInit(): void {
|
export const thresholdCtlInit = (): void => {
|
||||||
thresholdUpdate()
|
thresholdUpdate()
|
||||||
const dec = document.getElementById('thresholdDec') as HTMLButtonElement
|
const dec = document.getElementById('thresholdDec') as HTMLButtonElement
|
||||||
dec.addEventListener(
|
dec.addEventListener(
|
||||||
|
|||||||
Reference in New Issue
Block a user