MCPcopy
hub / github.com/FormidableLabs/webpack-dashboard / constructor

Method constructor

dashboard/index.js:29–91  ·  view source on GitHub ↗
(options)

Source from the content-addressed store, hash-verified

27class Dashboard {
28 // eslint-disable-next-line max-statements
29 constructor(options) {
30 // Options, params
31 options = options || {};
32 const title = options.title || "webpack-dashboard";
33
34 this.color = options.color || "green";
35 this.minimal = options.minimal || false;
36 this.stats = null;
37
38 // Data binding, lookup tables.
39 this.actionForMessageType = {
40 progress: this.setProgress.bind(this),
41 operations: this.setOperations.bind(this),
42 status: this.setStatus.bind(this),
43 stats: this.setStats.bind(this),
44 log: this.setLog.bind(this),
45 clear: this.clear.bind(this),
46 sizes: _data => {
47 if (this.minimal) {
48 return;
49 }
50 if (_data.value instanceof Error) {
51 this.setSizesError(_data.value);
52 } else {
53 this.setSizes(_data);
54 }
55 },
56 problems: _data => {
57 if (this.minimal) {
58 return;
59 }
60 if (_data.value instanceof Error) {
61 this.setProblemsError(_data.value);
62 } else {
63 this.setProblems(_data);
64 }
65 }
66 };
67
68 // Start UI stuff.
69 this.screen = blessed.screen({
70 title,
71 smartCSR: true,
72 dockBorders: false,
73 fullUnicode: true,
74 autoPadding: true
75 });
76
77 this.layoutLog();
78 this.layoutStatus();
79
80 if (!this.minimal) {
81 this.layoutModules();
82 this.layoutAssets();
83 this.layoutProblems();
84 }
85
86 this.screen.key(["escape", "q", "C-c"], () => {

Callers

nothing calls this directly

Calls 9

setSizesErrorMethod · 0.95
setSizesMethod · 0.95
setProblemsErrorMethod · 0.95
setProblemsMethod · 0.95
layoutLogMethod · 0.95
layoutStatusMethod · 0.95
layoutModulesMethod · 0.95
layoutAssetsMethod · 0.95
layoutProblemsMethod · 0.95

Tested by

no test coverage detected