-
Notifications
You must be signed in to change notification settings - Fork 57
Expand file tree
/
Copy pathprinter.ts
More file actions
28 lines (25 loc) · 805 Bytes
/
printer.ts
File metadata and controls
28 lines (25 loc) · 805 Bytes
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
/**
* Copyright (c) 2021 Hengyang Zhang
*
* This software is released under the MIT License.
* https://opensource.org/licenses/MIT
*/
import { sendMsg2Runtime } from "@api/chrome/runtime"
import { formatPeriodCommon } from "@util/time"
import { t } from "./locale"
/**
* Print info of today
*/
export default async function printInfo(host: string) {
const waste = await sendMsg2Runtime<string, timer.core.Result>('cs.getTodayInfo', host)
const { time, focus } = waste || {}
const param = {
time: `${time ?? '-'}`,
focus: formatPeriodCommon(focus ?? 0),
host,
}
const info0 = t(msg => msg.console.consoleLog, param)
const info1 = t(msg => msg.console.closeAlert, { appName: t(msg => msg.meta.name) })
console.log(info0)
console.log(info1)
}