1
0
mirror of https://github.com/locomotivemtl/locomotive-boilerplate.git synced 2026-01-15 00:55:08 +08:00

Config namespaces

This commit is contained in:
Lucas Vallenet
2023-04-05 15:06:51 -04:00
parent 8894664743
commit 1a81c865ae
10 changed files with 23 additions and 23 deletions

View File

@@ -1,3 +1,3 @@
{
"version": 1675955478084
"version": 1680721594993
}

View File

@@ -3,7 +3,7 @@ import * as modules from './modules';
import globals from './globals';
import { debounce } from './utils/tickers'
import { $html } from './utils/dom';
import { ENV, FONTS, CUSTOM_EVENTS, CSS_CLASS } from './config'
import { ENV, FONT, CUSTOM_EVENT, CSS_CLASS } from './config'
import { isFontLoadingAPIAvailable, loadFonts } from './utils/fonts';
const app = new modular({
@@ -36,7 +36,7 @@ function init() {
$html.classList.remove(CSS_CLASS.LOADING);
// Bind window resize event with default vars
const resizeEndEvent = new CustomEvent(CUSTOM_EVENTS.RESIZE_END)
const resizeEndEvent = new CustomEvent(CUSTOM_EVENT.RESIZE_END)
window.addEventListener('resize', () => {
$html.style.setProperty('--vw', `${document.documentElement.clientWidth * 0.01}px`)
debounce(() => {
@@ -48,7 +48,7 @@ function init() {
* Eagerly load the following fonts.
*/
if (isFontLoadingAPIAvailable) {
loadFonts(FONTS.EAGER_FONTS, ENV.IS_DEV).then((eagerFonts) => {
loadFonts(FONT.EAGER_FONTS, ENV.IS_DEV).then((eagerFonts) => {
$html.classList.add(CSS_CLASS.FONTS_LOADED);
if (ENV.IS_DEV) {

View File

@@ -41,16 +41,16 @@ const CUSTOM_EVENT = Object.freeze({
})
// Fonts parameters
const FONTS = Object.freeze({
const FONT = Object.freeze({
EAGER: [
{ family: 'Source Sans', style: 'normal', weight: 400 },
{ family: 'Source Sans', style: 'normal', weight: 700 },
],
})
export default {
export {
ENV,
CSS_CLASS,
CUSTOM_EVENT,
FONTS,
FONT,
}

View File

@@ -1,5 +1,5 @@
import { module } from 'modujs';
import { FONTS } from '../config';
import { FONT } from '../config';
import { whenReady } from '../utils/fonts';
export default class extends module {
@@ -8,7 +8,7 @@ export default class extends module {
}
init() {
whenReady(FONTS.EAGER).then((fonts) => this.onFontsLoaded(fonts));
whenReady(FONT.EAGER).then((fonts) => this.onFontsLoaded(fonts));
}
onFontsLoaded(fonts) {

View File

@@ -1,7 +1,7 @@
const $html = document.documentElement
const $body = document.body
export default {
export {
$html,
$body,
}

View File

@@ -1,4 +1,4 @@
import { CSS_CLASS } from './config'
import { CSS_CLASS } from '../config'
/**
* Get an image meta data

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long