Skip to content

Commit

Permalink
Merge pull request #11 from savioserra/fix/bump-deps
Browse files Browse the repository at this point in the history
Bump deps
  • Loading branch information
savioserra authored Mar 19, 2021
2 parents bbee4ef + d32ec58 commit d9f2891
Show file tree
Hide file tree
Showing 3 changed files with 1,002 additions and 1,054 deletions.
10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"name": "theme-switcher",
"displayName": "Theme Switcher",
"description": "Choose which themes should be activated which hour!",
"version": "2.0.1",
"description": "Choose which themes should be activated at any time!",
"version": "2.0.2",
"publisher": "savioserra",
"icon": "assets/icon128.png",
"repository": {
Expand Down Expand Up @@ -37,7 +37,7 @@
"themeswitcher.mappings": {
"default": [],
"type": "array",
"description": "Array of mapping defining when each theme should be activated",
"description": "Array of mappings defining when each theme should be activated.",
"examples": [
[
{
Expand All @@ -59,11 +59,11 @@
"properties": {
"time": {
"type": "string",
"description": "When this theme should be activated.",
"description": "The time when the theme should be activated.",
"pattern": "^([0-9]|0[0-9]|1[0-9]|2[0-3]):[0-5][0-9]$"
},
"theme": {
"description": "Theme to be activated",
"description": "Theme's name to be activated.",
"type": "string"
}
}
Expand Down
13 changes: 4 additions & 9 deletions src/ThemeScheduler.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import * as moment from "moment";

import { ConfigurationTarget, workspace } from "vscode";
import ConfigurationManager, { MappingData } from "./ConfigurationManager";
import { maxBy } from "lodash";

Expand Down Expand Up @@ -33,7 +32,7 @@ export default class ThemeScheduler {
scheduleAll(mappings: MappingData[]) {
this.clear();

const millisecondsMap = mappings.map(mapping => {
const millisecondsMap = mappings.map((mapping) => {
const ms = this.getTimeMillisecondsOffset(mapping.time);
return { ms, mapping };
});
Expand All @@ -56,7 +55,7 @@ export default class ThemeScheduler {
)
.map(({ mapping }) => ({
ms: this.getTimeMillisecondsOffset(mapping.time, 1),
mapping
mapping,
}));

const todaySchedules = [lastScheduledMapping, ...toBeSchedule];
Expand All @@ -77,7 +76,7 @@ export default class ThemeScheduler {
originTask: NodeJS.Timeout
): Promise<void> {
await ConfigurationManager.switchTheme(theme);
this.pendingTasks = this.pendingTasks.filter(t => t !== originTask);
this.pendingTasks = this.pendingTasks.filter((t) => t !== originTask);

this.schedule({ theme, time }, ThemeScheduler.dayMs);
}
Expand All @@ -96,11 +95,7 @@ export default class ThemeScheduler {

const toBeSchedule = now
.clone()
.set({
hour: datetime.hour(),
minute: datetime.minute(),
second: datetime.second()
})
.set({ h: datetime.hour(), m: datetime.minute(), s: datetime.second() })
.add(daysOffset, "days");

return toBeSchedule.diff(now, "milliseconds");
Expand Down
Loading

0 comments on commit d9f2891

Please sign in to comment.