@moreonion/js-utils v0.1.2
mo-js-utils
A collection of JavaScript utility functions for use in themes.
Utility functions
MO.utils.debounce(func, timeout = 100)MO.utils.storageAvailable(type)
Development
Install nodejs and yarn, then install the needed dependencies:
apt install nodejs yarn
yarn installUse the different yarn scripts for the development workflow:
yarn run lint
yarn run test
yarn run devFor building a releaseable artifact (library file) use:
yarn run distThe development files are configured to be created under build/, the
releaseable files are created under dist/.
Advanced use
This project uses Parcel for bundling. For options run:
yarn run parcel --helpSetting the --global MO option publishes the functions via a window.MO
global.
In order to build the JavaScript without [hash] in the file name, just use
the main.js as entrypoint (not the .html file) when building:
yarn run parcel build --global MO src/main.jsIt has eslint and babel configured for the source and test files.
Tests are run via mocha, assertions use Node's assert().
Mocking can be done with sinon.
6 years ago