UNPKG

timekit-sdk

Version:

JavaScript SDK for the Timekit API (timekit.io)

54 lines (53 loc) 2.08 kB
<!doctype html> <html> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> <title></title> <meta name="description" content=""> <meta name="viewport" content="width=device-width, initial-scale=1"> <style type="text/css"> body { font-family: helvetica, verdana, arial, sans-serif; color: #383838; margin: 30px; } code { font-family: monospace; } </style> </head> <body> <h1>Timekit JS SDK vanilla example</h1> <p>This is the most minimal boilerplate demo of timekit sdk used in the browser. Fire up your console (CMD+ALT+I) and use the SDK by hitting methods on the "timekit" global variable, e.g.</p> <code> timekit.configure({<br /> &nbsp;&nbsp;app: 'back-to-the-future',<br /> &nbsp;&nbsp;inputTimestampFormat: 'l h:i a Y-m-d'<br /> }); </code><br /><br /> <code> timekit.auth({<br /> &nbsp;&nbsp;email: 'doc.brown@timekit.io',<br /> &nbsp;&nbsp;password: 'DeLorean'<br /> }).then(function(response) {<br /> &nbsp;&nbsp;console.log('user authenticated!');<br /> &nbsp;&nbsp;console.log(response);<br /> }).catch(function(response) {<br /> &nbsp;&nbsp;console.log('an error occured!');<br /> &nbsp;&nbsp;console.log(response);<br /> }); </code><br /><br /> <code> timekit.findTime({<br /> &nbsp;&nbsp;emails: ['doc.brown@timekit.io', 'marty.mcfly@timekit.io'],<br /> &nbsp;&nbsp;future: '3 days',<br /> &nbsp;&nbsp;duration: '30 minutes'<br /> }).then(function(response) {<br /> &nbsp;&nbsp;console.log('find time OK, heres the result:');<br /> &nbsp;&nbsp;console.log(response);<br /> }); </code> <script src="../../dist/timekit-sdk.js"></script> </body> </html>