This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const MILLISECONDS_IN_A_SECOND: number = 1000; | |
const SECONDS_IN_A_MINUTE: number = 60; | |
const MINUTES_IN_AN_HOUR: number = 60; | |
const HOURS_IN_A_DAY: number = 24; | |
const DAYS_IN_A_WEEK: number = 7; | |
const MILLISECONDS_IN_A_MINUTE = MILLISECONDS_IN_A_SECOND * SECONDS_IN_A_MINUTE; | |
const MILLISECONDS_IN_AN_HOUR = MILLISECONDS_IN_A_MINUTE * MINUTES_IN_AN_HOUR; | |
const MILLISECONDS_IN_A_DAY = MILLISECONDS_IN_AN_HOUR * HOURS_IN_A_DAY; | |
const MILLISECONDS_IN_A_WEEK = MILLISECONDS_IN_A_DAY * DAYS_IN_A_WEEK; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const form = document.querySelector("form"); | |
form.addEventListener("submit", submitUserData); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const getArguments = require('get-arguments-lib'); // Getting port & proxy hostname for arguments | |
const read = require('read'); // Use to silence password | |
const args = getArguments(process.argv); | |
const port = args.port || 8080; | |
const hostname = args.hostname | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export const mapArrayItems = (data = []) => { | |
if (!Array.isArray(data)) { | |
return null; | |
} | |
return data.map((item) => { | |
// some mapping | |
}) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export const mapTreeNodes = (data = []) => data.map((item) => { | |
// Do somethong | |
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
async canGoOn(routeData, guard, oldGuard, prevUrl) { | |
let result = true; | |
if (oldGuard) { | |
result = await oldGuard(prevUrl); | |
} | |
if (guard && result) { | |
result = await guard(routeData) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
path: '/addImage', | |
element: 'div', | |
attributes: {is: 'add-image'}, | |
deactivateGuard: confirmExit | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const confirmExit = async () => { | |
const confirmModal = document.createElement('confirm-modal'); | |
confirmModal.comfirmQuestion = 'Are you sure?'; | |
document.body.appendChild(confirmModal); | |
const result = await confirmModal.getUserResult(); | |
document.body.removeChild(confirmModal); | |
return result; | |
} |
NewerOlder