DefinitelyTyped/types/humane-js/humane-js-tests.ts
Christophe Coevoet 0f0d84477c [humane-js] Fix humane-js types (#40043)
* Rename the humane types to humane-js to match the package name

* Improve humane-js types

- define the exported CommonJS API instead of documenting the global
  variable from the UMD pattern
- fix the list of available options
- use proper signatures for various functions instead of generic
  Function types
- use optional parameters instead of function overload without extra
  params for proper types

* Enable the strict linting rules for the humane-js types
2019-11-05 13:25:01 -08:00

28 lines
1.1 KiB
TypeScript

import humane = require('humane-js');
humane.log("Welcome Back");
humane.log(["List", "of", "Items"]);
humane.log("Callback when finished", () => { document.body.style.backgroundColor = "#a66000"; });
humane.log("Options can be passed", { timeout: 4000, clickToClose: true, addnCls: 'humane-error' });
humane.timeout = 5000;
humane.waitForMove = true;
humane.clickToClose = true;
humane.addnCls = 'humane-info';
humane.info = humane.spawn({ addnCls: 'humane-libnotify-info', timeout: 1000 });
humane.info('Info Themed Notifier');
humane.error = humane.spawn({ addnCls: 'humane-libnotify-error', timeout: 1000 });
humane.error('Error Themed Notifier');
humane.remove(() => alert('removed'));
const bigbox = humane.create({baseCls: 'humane-bigbox', timeout: 1000});
bigbox.error = bigbox.spawn({addnCls: 'humane-bigbox-error'});
bigbox.log('Oh!').error('No!');
const libnotify = humane.create({baseCls: 'humane-libnotify', addnCls: 'humane-libnotify-info'});
libnotify.log('Notified');
const jacked = humane.create({baseCls: 'humane-jackedup', addnCls: 'humane-jackedup-success'});
jacked.log("What's up here!");