-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathextension.js
43 lines (31 loc) · 1.08 KB
/
extension.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
const vscode = require('vscode');
const Timer = require('./timer.js');
const stats = require('./stats.js');
var sessions = require('./sessions.json');
/**
* @param {vscode.ExtensionContext} context
*/
function activate(context) {
const statusBar = vscode.window.createStatusBarItem(vscode.StatusBarAlignment.Right, 100);
const time = new Timer(statusBar);
let resetTime = vscode.commands.registerCommand('timer.resetTimer', function () {
time.second = 0
time.minute = 0
time.hour = 0
vscode.window.showInformationMessage('Successfully Reset Timer!');
});
let statsPage = vscode.commands.registerCommand('timer.viewAnalytics', function () {
const panel = vscode.window.createWebviewPanel('stats', 'Analytics', vscode.ViewColumn.One, {enableScripts: true});
panel.webview.html = stats.renderAnalytics();
panel.webview.postMessage(sessions);
});
statusBar.command = "timer.viewAnalytics"
context.subscriptions.push(statusBar);
context.subscriptions.push(resetTime);
context.subscriptions.push(statsPage);
};
function deactivate() {}
module.exports = {
activate,
deactivate
}