static-console-plugin-alert-output
v1.0.1
Published
Plugin for printing your `static-console` messages using `window.alert`.
Downloads
6
Maintainers
Readme
static-console-plugin-alert-output
Plugin for printing your static-console
messages using window.alert
.
Install
$ npm install --save static-console-plugin-alert-output
API
AlertOutput
const c = require('static-console');
const AlertOutput = require('static-console-plugin-alert-output');
c.outputs.myLog = new AlertOutput();
c.routers.std.tasks.set(c.outputs.myLog, c.models.raw);// We add task for StdRouter bundled with StaticConsole to convert messages with RawModel
c.logt('info', `Starting log`);
c.log(`Another message`);
Test in any browser environment bundled with Node.js.
c.outputs.myLog
is now invoking alert modal with each new message.
AlertOutput
may be used as alternative to standard output in case when it is not available.
Note: alert
has blocking implementation, used in syncronised code. If you want non-blocking API, try other plugin for static-console
.
print(model)
model
is the object that should have descriptive properties:
data
- string with message. It could be converted with RawModel.
window
Defines window in which alert
will be called. Default: window
.