diff --git a/package-lock.json b/package-lock.json index ec2db97..f4fce85 100644 --- a/package-lock.json +++ b/package-lock.json @@ -10,8 +10,6 @@ "license": "GPLv3", "dependencies": { "date-fns": "^4.1.0", - "dayjs": "^1.11.13", - "got": "^14.4.5", "is-online": "^11.0.0", "suncalc": "^1.8.0" }, @@ -1736,20 +1734,9 @@ "version": "0.4.1", "resolved": "https://registry.npmjs.org/@sec-ant/readable-stream/-/readable-stream-0.4.1.tgz", "integrity": "sha512-831qok9r2t8AlxLko40y2ebgSDhenenCatLVeW/uBtnHPyhHOvG0C7TvfgecV+wHzIm5KUICgzmVpWS+IMEAeg==", + "dev": true, "license": "MIT" }, - "node_modules/@sindresorhus/is": { - "version": "7.0.1", - "resolved": "https://registry.npmjs.org/@sindresorhus/is/-/is-7.0.1.tgz", - "integrity": "sha512-QWLl2P+rsCJeofkDNIT3WFmb6NrRud1SUYW8dIhXK/46XFV8Q/g7Bsvib0Askb0reRLe+WYPeeE+l5cH7SlkuQ==", - "license": "MIT", - "engines": { - "node": ">=18" - }, - "funding": { - "url": "https://github.com/sindresorhus/is?sponsor=1" - } - }, "node_modules/@sindresorhus/merge-streams": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/@sindresorhus/merge-streams/-/merge-streams-4.0.0.tgz", @@ -2578,24 +2565,6 @@ "node": ">=14.16" } }, - "node_modules/cacheable-request": { - "version": "12.0.1", - "resolved": "https://registry.npmjs.org/cacheable-request/-/cacheable-request-12.0.1.tgz", - "integrity": "sha512-Yo9wGIQUaAfIbk+qY0X4cDQgCosecfBe3V9NSyeY4qPC2SAkbCS4Xj79VP8WOzitpJUZKc/wsRCYF5ariDIwkg==", - "license": "MIT", - "dependencies": { - "@types/http-cache-semantics": "^4.0.4", - "get-stream": "^9.0.1", - "http-cache-semantics": "^4.1.1", - "keyv": "^4.5.4", - "mimic-response": "^4.0.0", - "normalize-url": "^8.0.1", - "responselike": "^3.0.0" - }, - "engines": { - "node": ">=18" - } - }, "node_modules/call-bind-apply-helpers": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/call-bind-apply-helpers/-/call-bind-apply-helpers-1.0.1.tgz", @@ -3543,12 +3512,6 @@ "url": "https://github.com/sponsors/kossnocorp" } }, - "node_modules/dayjs": { - "version": "1.11.13", - "resolved": "https://registry.npmjs.org/dayjs/-/dayjs-1.11.13.tgz", - "integrity": "sha512-oaMBel6gjolK862uaPQOVTA7q3TZhuSvuMQAAglQDOWYO9A91IrAOUJEyKVlqJlHE0vq5p5UXxzdPfMH/x6xNg==", - "license": "MIT" - }, "node_modules/debug": { "version": "4.4.0", "resolved": "https://registry.npmjs.org/debug/-/debug-4.4.0.tgz", @@ -4327,15 +4290,6 @@ "node": ">= 6" } }, - "node_modules/form-data-encoder": { - "version": "4.0.2", - "resolved": "https://registry.npmjs.org/form-data-encoder/-/form-data-encoder-4.0.2.tgz", - "integrity": "sha512-KQVhvhK8ZkWzxKxOr56CPulAhH3dobtuQ4+hNQ+HekH/Wp5gSOafqRAeTphQUJAIk0GBvHZgJ2ZGRWd5kphMuw==", - "license": "MIT", - "engines": { - "node": ">= 18" - } - }, "node_modules/fs-constants": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/fs-constants/-/fs-constants-1.0.0.tgz", @@ -4439,6 +4393,7 @@ "version": "9.0.1", "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-9.0.1.tgz", "integrity": "sha512-kVCxPF3vQM/N0B1PmoqVUqgHP+EeVjmZSQn+1oCRPxd2P21P2F19lIgbR3HBosbB1PUhOAoctJnfEn2GbN2eZA==", + "dev": true, "license": "MIT", "dependencies": { "@sec-ant/readable-stream": "^0.4.1", @@ -4713,31 +4668,6 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/got": { - "version": "14.4.5", - "resolved": "https://registry.npmjs.org/got/-/got-14.4.5.tgz", - "integrity": "sha512-sq+uET8TnNKRNnjEOPJzMcxeI0irT8BBNmf+GtZcJpmhYsQM1DSKmCROUjPWKsXZ5HzwD5Cf5/RV+QD9BSTxJg==", - "license": "MIT", - "dependencies": { - "@sindresorhus/is": "^7.0.1", - "@szmarczak/http-timer": "^5.0.1", - "cacheable-lookup": "^7.0.0", - "cacheable-request": "^12.0.1", - "decompress-response": "^6.0.0", - "form-data-encoder": "^4.0.2", - "http2-wrapper": "^2.2.1", - "lowercase-keys": "^3.0.0", - "p-cancelable": "^4.0.1", - "responselike": "^3.0.0", - "type-fest": "^4.26.1" - }, - "engines": { - "node": ">=20" - }, - "funding": { - "url": "https://github.com/sindresorhus/got?sponsor=1" - } - }, "node_modules/graceful-fs": { "version": "4.2.11", "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.11.tgz", @@ -5468,6 +5398,7 @@ "version": "4.0.1", "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-4.0.1.tgz", "integrity": "sha512-Dnz92NInDqYckGEUJv689RbRiTSEHCQ7wOVeALbkOz999YpqT46yMRIGtSNl2iCL1waAZSx40+h59NV/EwzV/A==", + "dev": true, "license": "MIT", "engines": { "node": ">=18" @@ -6715,15 +6646,6 @@ "node": ">=12.20" } }, - "node_modules/p-cancelable": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/p-cancelable/-/p-cancelable-4.0.1.tgz", - "integrity": "sha512-wBowNApzd45EIKdO1LaU+LrMBwAcjfPaYtVzV3lmfM3gf8Z4CHZsiIqlM8TZZ8okYvh5A1cP6gTfCRQtwUpaUg==", - "license": "MIT", - "engines": { - "node": ">=14.16" - } - }, "node_modules/p-limit": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-4.0.0.tgz", @@ -8532,6 +8454,7 @@ "version": "4.33.0", "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-4.33.0.tgz", "integrity": "sha512-s6zVrxuyKbbAsSAD5ZPTB77q4YIdRctkTbJ2/Dqlinwz+8ooH2gd+YA7VA6Pa93KML9GockVvoxjZ2vHP+mu8g==", + "dev": true, "license": "(MIT OR CC0-1.0)", "engines": { "node": ">=16" diff --git a/package.json b/package.json index f13af0b..2ccdb6e 100644 --- a/package.json +++ b/package.json @@ -33,8 +33,6 @@ }, "dependencies": { "date-fns": "^4.1.0", - "dayjs": "^1.11.13", - "got": "^14.4.5", "is-online": "^11.0.0", "suncalc": "^1.8.0" }, @@ -77,10 +75,6 @@ { "command": "sundial.disableExtension", "title": "Sundial: Disable extension" - }, - { - "command": "sundial.pauseUntilNextCircle", - "title": "Sundial: Pause until next circle" } ], "keybindings": [ @@ -146,11 +140,6 @@ "type": "number", "default": 5, "description": "Set in which interval Sundial should check the time. (in minutes)" - }, - "sundial.debug": { - "type": "number", - "default": 1, - "description": "Set debug level: silent = 0, info = 1, error = 2, debug = 3" } } } diff --git a/src/editor.ts b/src/editor.ts index 2f138a2..534809e 100644 --- a/src/editor.ts +++ b/src/editor.ts @@ -1,14 +1,8 @@ -import dayjs from "dayjs" -import customParseFormat from "dayjs/plugin/customParseFormat" import { type WorkspaceConfiguration, window, workspace } from "vscode" -import { getLogger } from "./logger.js" +import { log } from "./logger.js" import type { SundialConfiguration } from "./sundial.js" -const log = getLogger("editor") - -dayjs.extend(customParseFormat) - export function getConfig() { return { sundial: workspace.getConfiguration("sundial") as SundialConfiguration, @@ -21,7 +15,7 @@ export function applySettings(settings: WorkspaceConfiguration): void { return // no settings, nothing to do } - log.debug("Changing settings to:", JSON.stringify(settings, undefined, 2)) + // log.debug("NEW", JSON.stringify(settings, undefined, 2)) const workspaceSettings = workspace.getConfiguration() @@ -47,7 +41,7 @@ export enum TimeName { } export function changeThemeTo(newTheme: string): void { - log.debug("Changing theme to:", newTheme) + log.debug("Changing theme to", newTheme) const { workbench } = getConfig() if (newTheme !== workbench.colorTheme) { workbench.update("colorTheme", newTheme, true) diff --git a/src/extension.ts b/src/extension.ts index 44a9f62..346bb22 100644 --- a/src/extension.ts +++ b/src/extension.ts @@ -52,9 +52,6 @@ export function activate(context: ExtensionContext): void { commands.registerCommand("sundial.enableExtension", () => sundial.enableExtension()) commands.registerCommand("sundial.disableExtension", () => sundial.disableExtension()) - commands.registerCommand("sundial.pauseUntilNextCircle", () => - sundial.pauseUntilNextCircle(), - ) } export function deactivate(): void { diff --git a/src/logger.ts b/src/logger.ts index 59d8b4b..d0aa113 100644 --- a/src/logger.ts +++ b/src/logger.ts @@ -1,32 +1,17 @@ import { window } from "vscode" -export enum LogLevel { +enum LogLevel { Silent = 0, Info = 1, Error = 2, Debug = 3, } -type AllowedTypes = string | number | boolean | object +type AllowedTypes = string | number | boolean | Date -export const loggers: Logger[] = [] export const outputChannel = window.createOutputChannel("Sundial") -export function setLogLevelAll(level: LogLevel): void { - for (const l of loggers) { - l.logLevel = level - } -} - class Logger { - readonly name: string - logLevel: LogLevel - - constructor(name: string, logLevel = LogLevel.Info) { - this.name = name - this.logLevel = logLevel - } - info(...messages: AllowedTypes[]) { this.log(messages, LogLevel.Info) } @@ -40,28 +25,9 @@ class Logger { } private log(messages: AllowedTypes[], level: LogLevel = LogLevel.Silent) { - if (this.logLevel < level) { - return - } - outputChannel.appendLine(this.buildLogString(level, messages)) - } - - private buildLogString(logLevel: LogLevel, messages: AllowedTypes[]): string { - const template: string[] = [] - template.push(`[${LogLevel[logLevel].toUpperCase()}]`, `(Sundial:${this.name})`, "=>") - for (const message of messages) { - template.push(message.toString()) - } - return template.join(" ") + const logMessage = `[${LogLevel[level].toUpperCase()}] ${messages.join(" ")}` + outputChannel.appendLine(logMessage) } } -export function getLogger(name: string): Logger { - const logger = loggers.find((l) => l.name === name) - if (logger) { - return logger - } - const newLogger = new Logger(name) - loggers.push(newLogger) - return newLogger -} +export const log = new Logger() diff --git a/src/sensors/autolocale.ts b/src/sensors/autolocale.ts index 3f10472..0eb5f26 100644 --- a/src/sensors/autolocale.ts +++ b/src/sensors/autolocale.ts @@ -1,11 +1,9 @@ -import dayjs from "dayjs" -import got from "got" import isOnline from "is-online" import { getTimes } from "suncalc" import { window } from "vscode" -import { getConfig } from "../editor.js" -import { LogLevel, getLogger } from "../logger.js" +import { addMinutes, isAfter } from "date-fns" +import { log } from "../logger.js" import { Sundial, type Tides } from "../sundial.js" interface Response { @@ -13,32 +11,28 @@ interface Response { lon: number } -let now = dayjs() -let end = now.add(-1, "minute") +let now = new Date() +let end = addMinutes(now, -1) export async function getAutoLocale(): Promise { - const log = getLogger("useAutoLocale") + now = new Date() - now = dayjs() - - const timeout = now.isAfter(end, "minute") + const timeout = isAfter(now, end) const context = Sundial.extensionContext let latitude = context.globalState.get("userLatitude") let longitude = context.globalState.get("userLongitude") - log.debug("Timeout:", timeout) + log.debug("Auto locale timeout", timeout) - const config = getConfig() const connected = await isOnline() - if (connected && (timeout || config.sundial.debug === LogLevel.Debug)) { - end = now.add(5, "minute") + if (connected && timeout) { + end = addMinutes(now, 5) try { - const { lat, lon }: Response = await got( - "http://ip-api.com/json/?fields=lat,lon", - ).json() + const response = await fetch("http://ip-api.com/json/?fields=lat,lon") + const { lat, lon } = (await response.json()) as Response latitude = lat longitude = lon @@ -46,32 +40,30 @@ export async function getAutoLocale(): Promise { context.globalState.update("userLatitude", latitude) context.globalState.update("userLongitude", longitude) } catch (error) { - log.error(error as string) - window.showErrorMessage( - "Oops, something went wrong collecting your geolocation! " + - "Maybe it is a problem with the API. Please create an issue " + - "on GitHub should this problem persist.", - ) + if (error instanceof Error) { + log.error(error.message) + } + window.showErrorMessage("Fetching your location went wrong, please open an issue") } } else { - log.info("Not connected to internet, reusing existing geolocation") + log.info("Not connected, reusing existing geolocation") } if (!(latitude && longitude)) { latitude = 0 longitude = 0 window.showInformationMessage( - "It seems you have been offline since the first start of VS Code, so we haven't had the chance to cache your location. Please go online or set your location manually.", + "Unable to fetch or use cached location, please set manually", ) } - log.debug("Latitude:", latitude) - log.debug("Longitude:", longitude) + log.debug("Auto locale latitude", latitude) + log.debug("Auto locale longitude", longitude) - const tides = getTimes(now.toDate(), latitude, longitude) + const tides = getTimes(now, latitude, longitude) return { - sunrise: dayjs(tides.sunrise), - sunset: dayjs(tides.sunset), + sunrise: tides.sunrise, + sunset: tides.sunset, } } diff --git a/src/sensors/latlong.ts b/src/sensors/latlong.ts index 8c5acbb..23719a0 100644 --- a/src/sensors/latlong.ts +++ b/src/sensors/latlong.ts @@ -1,33 +1,28 @@ -import dayjs from "dayjs" import { getTimes } from "suncalc" import { window } from "vscode" import { getConfig } from "../editor.js" -import { getLogger } from "../logger.js" +import { log } from "../logger.js" import type { Tides } from "../sundial.js" export function getLatLong(): Tides { - const now = dayjs() - const log = getLogger("useLatitudeLongitude") const config = getConfig() if (!(config.sundial.latitude && config.sundial.longitude)) { - throw window.showErrorMessage( - "Sundial needs both, latitude and longitude, to work with this configuration!", - ) + throw window.showErrorMessage("Sundial needs both, latitude and longitude") } - log.debug("Latitude:", config.sundial.latitude) - log.debug("Longitude:", config.sundial.longitude) + log.debug("Config latitude", config.sundial.latitude) + log.debug("Config longitude", config.sundial.longitude) const tides = getTimes( - now.toDate(), + new Date(), Number(config.sundial.latitude), Number(config.sundial.longitude), ) return { - sunrise: dayjs(tides.sunrise), - sunset: dayjs(tides.sunset), + sunrise: tides.sunrise, + sunset: tides.sunset, } } diff --git a/src/sundial.ts b/src/sundial.ts index a8e453e..9caf3e3 100755 --- a/src/sundial.ts +++ b/src/sundial.ts @@ -1,4 +1,4 @@ -import dayjs from "dayjs" +import { addMinutes, isAfter, isBefore, parse } from "date-fns" import { type ExtensionContext, StatusBarAlignment, @@ -8,16 +8,15 @@ import { } from "vscode" import { TimeName, changeToDay, changeToNight, getConfig, toggleTheme } from "./editor.js" -import { type LogLevel, getLogger, setLogLevelAll } from "./logger.js" +import { log } from "./logger.js" import { getAutoLocale } from "./sensors/autolocale.js" import { getLatLong } from "./sensors/latlong.js" -import { sleep } from "./utils.js" const STATE_ENABLED = "sundial.enabled" export interface Tides { - sunrise: dayjs.Dayjs - sunset: dayjs.Dayjs + sunrise: Date + sunset: Date } export interface SundialConfiguration extends WorkspaceConfiguration { @@ -32,7 +31,6 @@ export interface SundialConfiguration extends WorkspaceConfiguration { nightSettings: WorkspaceConfiguration statusBarItemPriority: number interval: number - debug: LogLevel } export class Sundial { @@ -42,7 +40,6 @@ export class Sundial { static extensionContext: ExtensionContext private isRunning = false - private nextCircle?: TimeName private checkInterval!: NodeJS.Timeout private statusBarItem?: StatusBarItem @@ -54,10 +51,8 @@ export class Sundial { * Enable the automation and checks. */ enableExtension(): void { - const log = getLogger("enableExtension") log.info("Enabling Sundial") Sundial.extensionContext.globalState.update(STATE_ENABLED, true) - this.nextCircle = undefined this.automator() this.check() this.createStatusBarIcon() @@ -67,22 +62,11 @@ export class Sundial { * Disable the extension automation and checks. */ disableExtension(): void { - const log = getLogger("disableExtension") log.info("Disabling Sundial") Sundial.extensionContext.globalState.update(STATE_ENABLED, false) this.killAutomator() } - /** - * Pause automated checks until next time circle. - */ - async pauseUntilNextCircle(): Promise { - const log = getLogger("pauseUntilNextCircle") - const currentTimeName = await this.getCurrentTime() - this.nextCircle = currentTimeName === TimeName.Day ? TimeName.Night : TimeName.Day - log.info(`Waiting until it becomes ${this.nextCircle} again...`) - } - /** * Create and start the automator interval. */ @@ -91,7 +75,6 @@ export class Sundial { this.killAutomator() return } - const log = getLogger("automator") const { sundial } = getConfig() if (sundial.interval === 0) { log.info("Automator offline") @@ -100,7 +83,7 @@ export class Sundial { log.info("Automator online") const interval = 1000 * 60 * sundial.interval this.checkInterval = setInterval(() => { - log.info("Autocheck") + log.info("Run autocheck") this.check() }, interval) } @@ -119,35 +102,23 @@ export class Sundial { if (!this.enabled || this.isRunning) { return // disabled or already running } - const log = getLogger("check") - log.info("Sundial check initialized") - log.debug(`With circle on ${this.nextCircle}`) + + log.info("Check initialized") this.isRunning = true this.killAutomator() - const { sundial } = getConfig() - setLogLevelAll(sundial.debug) const currentTimeName = await this.getCurrentTime() log.debug(`Current time is ${currentTimeName}`) - if (this.nextCircle) { - log.info("Waiting for next circle") - if (currentTimeName === this.nextCircle) { - log.info("Next circle reached!") - this.nextCircle = undefined - await this.check() - } - } else if (currentTimeName === TimeName.Day) { - log.info("Sundial will apply your day theme! 🌕") + if (currentTimeName === TimeName.Day) { + log.info("Will apply your day theme! 🌕") changeToDay() } else { - log.info("Sundial will apply your night theme! 🌑") + log.info("Will apply your night theme! 🌑") changeToNight() } - await sleep(400) // Short nap 😴 - this.isRunning = false this.automator() } @@ -194,19 +165,18 @@ export class Sundial { * Get current time name based on sunrise and sunset. */ private async getCurrentTime(): Promise { - const log = getLogger("getCurrentTime") const tides = await this.getTides() const { nowIsBeforeSunrise, nowIsAfterSunrise, nowIsBeforeSunset, nowIsAfterSunset } = this.evaluateTides(tides) if (nowIsAfterSunrise && nowIsBeforeSunset) { - log.debug(TimeName.Day) + log.debug("It is", TimeName.Day) return TimeName.Day } if (nowIsBeforeSunrise || nowIsAfterSunset) { - log.debug(TimeName.Night) + log.debug("It is", TimeName.Night) return TimeName.Night } @@ -216,50 +186,52 @@ export class Sundial { /** * Get sunrise and sunset based on user settings. */ - private async getTides() { - const log = getLogger("getTides") + private async getTides(): Promise { const { sundial } = getConfig() if (sundial.latitude && sundial.longitude) { - log.info("Sundial will use your latitude and longitude") + log.info("Will use your latitude and longitude") return getLatLong() } if (sundial.autoLocale) { - log.info("Sundial will now try to detect your location") + log.info("Will now try to detect your location") return await getAutoLocale() } - log.info("Sundial will use your time settings") + log.info("Will use your time settings") return { - sunrise: dayjs(sundial.sunrise, "HH:mm"), - sunset: dayjs(sundial.sunset, "HH:mm"), + sunrise: parse(sundial.sunrise, "HH:mm", new Date()), + sunset: parse(sundial.sunset, "HH:mm", new Date()), } } /** * Set the time variables based on tides. */ - private evaluateTides(givenTides: Tides) { - const log = getLogger("evaluateTides") + private evaluateTides(tides: Tides) { const { sundial } = getConfig() - let tides = givenTides - if (sundial.dayVariable || sundial.nightVariable) { - tides = this.setTimeVariables(tides) + let { sunrise, sunset } = tides + if (sundial.dayVariable) { + sunrise = addMinutes(sunrise, sundial.dayVariable) + log.debug(`Adjusted ${sundial.dayVariable} minutes from day`) + } + if (sundial.nightVariable) { + sunset = addMinutes(sunset, sundial.nightVariable) + log.debug(`Adjusted ${sundial.nightVariable} minutes from night`) } - const { sunrise, sunset } = tides - const now = dayjs() + const now = Date.now() - const nowIsBeforeSunrise = now.isBefore(sunrise) - const nowIsAfterSunrise = now.isAfter(sunrise) - const nowIsBeforeSunset = now.isBefore(sunset) - const nowIsAfterSunset = now.isAfter(sunset) + const nowIsBeforeSunrise = isBefore(now, sunrise) + const nowIsAfterSunrise = isAfter(now, sunrise) + const nowIsBeforeSunset = isBefore(now, sunset) + const nowIsAfterSunset = isAfter(now, sunset) - log.debug("Now:", now.format()) - log.debug("Sunrise:", sunrise.format()) - log.debug("Sunset:", sunset.format()) + log.debug("Now:", now) + log.debug("Sunrise:", sunrise) + log.debug("Sunset:", sunset) log.debug("nowIsBeforeSunrise:", nowIsBeforeSunrise) log.debug("nowIsAfterSunrise:", nowIsAfterSunrise) log.debug("nowIsBeforeSunset:", nowIsBeforeSunset) @@ -272,35 +244,4 @@ export class Sundial { nowIsAfterSunset, } } - - /** - * Set the time variables based on user settings. - */ - private setTimeVariables(tides: Tides) { - const log = getLogger("setTimeVariables") - const { sundial } = getConfig() - let { sunrise, sunset } = tides - - if (sundial.dayVariable) { - if (sundial.dayVariable > 0) { - sunrise = sunrise.add(sundial.dayVariable, "minute") - log.debug(`Added ${sundial.dayVariable} minutes from day`) - } else { - sunrise = sunrise.subtract(sundial.dayVariable * -1, "minute") - log.debug(`Subtracted ${sundial.dayVariable} minutes from day`) - } - } - - if (sundial.nightVariable) { - if (sundial.nightVariable > 0) { - sunset = sunset.add(sundial.nightVariable, "minute") - log.debug(`Added ${sundial.nightVariable} minutes from night`) - } else { - sunset = sunset.subtract(sundial.nightVariable * -1, "minute") - log.debug(`Subtracted ${sundial.nightVariable} minutes from night`) - } - } - - return { sunrise, sunset } - } } diff --git a/src/utils.ts b/src/utils.ts deleted file mode 100644 index 10cdba9..0000000 --- a/src/utils.ts +++ /dev/null @@ -1,5 +0,0 @@ -export function sleep(ms: number): Promise { - return new Promise((resolve) => { - return setTimeout(resolve, ms) - }) -} diff --git a/testProject/.vscode/settings.json b/testProject/.vscode/settings.json index 0a1b13a..8797bcc 100755 --- a/testProject/.vscode/settings.json +++ b/testProject/.vscode/settings.json @@ -5,14 +5,14 @@ "workbench.preferredLightColorTheme": "Default Light+", "sundial.debug": 3, // "sundial.autoLocale": true, - // "sundial.latitude": "25.7823907", - // "sundial.longitude": "-80.29967", + "sundial.latitude": "", + "sundial.longitude": "", "sundial.sunrise": "07:00", - "sundial.sunset": "21:00", + "sundial.sunset": "17:00", "sundial.dayVariable": 0, - "sundial.nightVariable": -60, + "sundial.nightVariable": 0, "sundial.daySettings": {}, "sundial.nightSettings": {}, "sundial.statusBarItemPriority": 101, - "sundial.interval": 2 + "sundial.interval": 10 }