mirror of
https://kevinblog.sytes.net/Code/Jibo-Revival-Group/jibo-cli.git
synced 2026-06-17 09:16:50 +00:00
Initial commit — jibo-cli v3.0.7 with bundled node_modules
This commit is contained in:
57
node_modules/skills-service-manager/startup/startup-view.js
generated
vendored
Normal file
57
node_modules/skills-service-manager/startup/startup-view.js
generated
vendored
Normal file
@@ -0,0 +1,57 @@
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* Wraps the GUI
|
||||
* @class StartupView
|
||||
*/
|
||||
class StartupView {
|
||||
constructor() {
|
||||
const $ = document.querySelector.bind(document); // poor-mans jquery
|
||||
this._parent = $('#view-screen');
|
||||
this._content = $('#view-content');
|
||||
this._message = $('#view-message');
|
||||
this._mode = 'normal';
|
||||
}
|
||||
|
||||
/**
|
||||
* Current developer mode, "developer", "int-developer", "normal"
|
||||
* @name mode
|
||||
* @type {String}
|
||||
*/
|
||||
set mode(mode) {
|
||||
if (mode !== 'developer' && mode !== 'int-developer') {
|
||||
// handle other modes like oobe, normal, etc
|
||||
mode = 'normal';
|
||||
}
|
||||
this._mode = mode;
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the result
|
||||
* @method complete
|
||||
* @param {Error|String} [err] If an error was generated
|
||||
*/
|
||||
complete(error) {
|
||||
this.replace(this._parent, 'mode-empty', 'mode-' + this._mode);
|
||||
if (error) {
|
||||
this.replace(this._content, 'status-loading', 'status-error');
|
||||
this._message.innerHTML = 'Failed startup: ' + error;
|
||||
return;
|
||||
}
|
||||
this.replace(this._content, 'status-loading', 'status-success');
|
||||
this._message.innerHTML = 'Waiting for skill to begin...';
|
||||
}
|
||||
|
||||
/**
|
||||
* Simple class name find and replace
|
||||
* @method replace
|
||||
* @param {HTMLElement} node
|
||||
* @param {String} find
|
||||
* @param {String} replace
|
||||
*/
|
||||
replace(node, find, replace) {
|
||||
node.className = node.className.replace(find, replace);
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = StartupView;
|
||||
Reference in New Issue
Block a user