1.1.1 • Published 9 years ago
simple-status v1.1.1
Simple Status
Installation
npm install simple-status --save-dev
Example Usage
var SimpleStatus = require('simple-status');
// Initialize with all possible statuses and optional initial current status.
// If no initial status is given, the initial current status will default to
// the first value in the array
var status = new SimpleStatus(['READY', 'STEADY', 'GO'], 'READY');
console.log(status.current); // 'READY'
// Set status, note, status is given properties equal to statuses
status.set(status.STEADY);
console.log(status.current); // 'STEADY'
// Setting status to unknown status throw exception
status.set('SOMETHING_UNKNOWN'); // Exception thrown
// Get readonly object of statuses
var readOnlyStatuses = status.getStatuses();
console.log(readOnlyStatuses.READY); // 'READY'
readOnlyStatuses.set('STEADY'); // Exception thrown
Build
webpack
Test
karma start karma.config.js