UNPKG

timekit-sdk

Version:

JavaScript SDK for the Timekit API (timekit.io)

57 lines (52 loc) 1.98 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 AMD module (require.js) example</h1> <p>First we load require.js and then require timekit.js as a dependency - see the page source code. When loaded, we can perform calls using the SDK.</p> <script type="text/javascript" src="http://requirejs.org/docs/release/2.1.18/minified/require.js"></script> <script type="text/javascript"> requirejs(['../../dist/timekit-sdk.js'], function(timekit) { console.log('timekit sdk loaded!'); timekit.configure({ app: 'back-to-the-future', inputTimestampFormat: 'l h:i a Y-m-d' }); timekit.auth({ email: 'doc.brown@timekit.io', password: 'DeLorean' }).then(function(response) { console.log('user authenticated!'); console.log(response); return timekit.findTime({ emails: ['doc.brown@timekit.io', 'marty.mcfly@timekit.io'], future: '3 days', duration: '30 minutes' }); }).then(function(response) { console.log('findtime executed!'); console.log(response); }).catch(function(response) { console.log('an error occured!'); console.log(response); }); }); </script> </body> </html>