Base
Helpers.js
Contains couple of helper methods that help for loading json data and formatting text.
Example
// Fired once in a 200ms after resize window.addEventListener('resize', Helpers.Debounce(function() { }, 200)); // Returns 3 as the next id var nextId = Helpers.NextId([{id:1, name:'John'}, {id:2, name:'Jack'}], 'id'); // Fetches a json file Helpers.FetchJSON('json/events.json', (data) => { // Returns 1,234.5 as comma added string var value = Helpers.AddCommas(1234.5); });
Reference
NAME
DESCRIPTION
NAME
Helpers.Debounce
DESCRIPTION
A basic debounce function for events like resize, keydown and etc.
NAME
Helpers.NextId
DESCRIPTION
Checks the given array and returns a value plus one from the greatest prop value
NAME
Helpers.FetchJSON
DESCRIPTION
Fetches data from the path parameter and fires onComplete callback with the json formatted data
NAME
Helpers.AddCommas
DESCRIPTION
Adds commas to thousand
NAME
Helpers.UrlFix
DESCRIPTION
If the project is run in a subdirectory and absolute-path is used, this function adds the data-url-prefix value defined in the html element to the paths.
Caller
This file doesn't need a caller since it is made of static methods. Used throughout the template by different files.