README
Waylay Client
Node.js client to interface with the Waylay API's
Installation
Installation in modern web applications
yarn add @waylay/client
or
npm install --save @waylay/client
With a script tag
You can also include the generated umd
file directly into a script tag. This will add a global waylay
function to the window
. You can access this via window.waylay
or just waylay
Include script tag
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
</head>
<body>
<!-- Place script tag at the end of body -->
<!-- to get the latest version: -->
<script src="https://unpkg.com/@waylay/client/dist/waylay.umd.js"></script>
<!-- to get a specific version: -->
<script src="https://unpkg.com/@waylay/client@2.39.0/dist/waylay.umd.js"></script>
</body>
</html>
Usage
When installed with npm
Create a new client:
const Waylay = require('@waylay/client')
const client = new Waylay({
clientID: 'CLIENT_ID',
secret: 'CLIENT_SECRET',
domain: 'my-domain.waylay.io'
})
When included with a script tag
// notice the lowercase waylay
const client = new waylay({
domain: DOMAIN
})
// login example
async function login(user, password) {
try {
await client.login(user, password)
} catch(err) {
// error happened while logging in
}
await client.loadSettings()
}
Documentation
Run the documentation server locally. Edit the documentation.yml file to adapt the table of content for the navigation side bar.
yarn documentation serve lib/waylay.js --config documentation.yml --watch
open http://localhost:4001
Browser
To use this in the browser
yarn build
To create an UMD minified bundle file in dist/waylay.umd.js
Test
yarn test
Release
npm version <major/minor/patch>
git push
git push --tags
npm publish --access=public
API
See documentation