Just change the name of the library in the package.json. That's it. The package name variable will be the entry point for the library in browser case. You can change this behaviour here tools/webpack.config.base.js the library field. Develop and enjoy.
- webpack for bundling, exporting in UMD (with the name of the package in browser case), support for process.env in source code
- babel, of course
- eslint (airbnb + valid-jsdoc)
- jasmine for test with mocha reporter
- documentation automagically generated
- git clone && rm .git && git init
- npm run build // generate dist/<package.name>.js, dist/<package.name>.min.js, dist/<package.name>.min.js.map
- npm run test
- npm run test:watch // run tests while typing
- npm run documentation // generate docs folder with .html, append docs to the readme.md
- npm version patch|minor|major This will generate the docs/ and dist/ so you can have the build version committed for that tag
Connection module. A simple module to check if connectivity is on or off Usage:
Examples
Connection.initialize();
const Listener = ({networkState, type}) => {console.log(networkState, type); }
Connection.addListener(Listener);
Connection.removeListener(Listener);
Connection.hostReachable(url?); //sync call to the current domain
bind listeners to online|offline events if it runs in cordova context must be called after deviceready and cordova-plugin-network should be installed
checkConnection
Returns object connectionStatus
Returns string connectionStatus.type online|offline
Returns string connectionStatus.networkState 'none', 'wifi', 3G, 4G
Register a function to be called on connection change
Parameters
listener
function the listener to register
UnRegister a function
Parameters
listener
function the listener to unregister
Host reachable make a simple sync HEAD request to location.hostname or custom url with a param to disable the cache
Parameters
url
[string] simple url to call without querystring (optional, defaultwindow.location.hostname
)
Returns boolean
type {object}
type {boolean}