diff --git a/notNeededPackages.json b/notNeededPackages.json index 4c3b10b2c6..6f51f1126a 100644 --- a/notNeededPackages.json +++ b/notNeededPackages.json @@ -876,6 +876,12 @@ "sourceRepoURL": "https://github.com/blakeembrey/sentence-case", "asOfVersion": "1.1.3" }, + { + "libraryName": "sharp-timer", + "typingsPackageName": "sharp-timer", + "sourceRepoURL": "https://github.com/afractal/SharpTimer", + "asOfVersion": "0.1.3" + }, { "libraryName": "Shopify Prime", "typingsPackageName": "shopify-prime", diff --git a/types/sharp-timer/index.d.ts b/types/sharp-timer/index.d.ts deleted file mode 100644 index 944da76b4f..0000000000 --- a/types/sharp-timer/index.d.ts +++ /dev/null @@ -1,302 +0,0 @@ -// Type definitions for sharp-timer library. 1.0 -// Project: https://github.com/afractal/SharpTimer -// Definitions by: Hermes Gjini - afractal -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - -/// - -export const millisPerSecond: 1000; -export const millisPerMinute: 60000; -export const millisPerHour: 3600000; -export const millisPerDay: 86400000; -export type ElapsedEvent = () => void; -export type ElapsingEvent = (intervalValue: number) => void; - -/** - * Simulates the actions of a generic timer, - * generates elapsing and elapsed events for a specified interval. - */ -export class Timer { - private _enabled: boolean; - private _stopped: boolean; - private _interval: number; - private _intervalElapsedEvents: ElapsedEvent[]; - private _intervalElapsingEvents: ElapsingEvent[]; - - /** - * Initializes a new instance of the Timer class, - * and sets all the properties to their initial values. - * @param interval - * The time, in milliseconds, in which the timer will be active. - * The value must be greater than zero. - */ - constructor(interval: number); - - /** - * Gets a boolean value to indicate the enabled state - * of the current Timer instance. - * @default true - */ - readonly enabled: boolean; - - /** - * Gets a boolean value to indicate the stopped state - * of the current Timer instance. - * @default false - */ - readonly stopped: boolean; - - /** - * Gets or sets the remaining interval in milliseconds. - * The value must be greater than zero. - */ - interval: number; - - /** - * Starts raising the Timer events - * by setting the enabled property to true. - */ - start(): void; - - /** - * Pauses the Timer instance by setting the enabled property to false. - */ - pause(): void; - - /** - * Resumes the Timer instance by setting the enabled property to true. - */ - resume(): void; - - /** - * Stops raising the Timer event - * by setting the enabled property to false. - */ - stop(): void; - - /** - * Occurs when the interval has completely elapsed. - * @param intervalElapsedHandler - * The callback which will be executed when - * the interval elapsed event occurs. - */ - onIntervalElapsed(intervalElapsedHandler: ElapsedEvent): void; - - /** - * Occurs when the interval elapses and completely elapsed. - * @param intervalElapsingHandler - * The callback which will be executed when - * the interval elapsing event occurs. - */ - onIntervalElapsing(intervalElapsingHandler: ElapsingEvent): void; - - /** - * Returns a string represenation of the remaining - * in this format: minutes:seconds. - * examples: 20:23, 00:04, 59:59 - */ - toString(): string; - - private getDoubleDigit(number: number): string; - - private checkForValidInterval(interval: number): void; -} - -/** - * Simulates the actions of a generic stopwatch. - */ -export class Stopwatch { - private _isRunning: boolean; - private _elapsedMilliseconds: number; - private _startedTimeInMillis: number; - private _intervalIds: Array; - - /** - * Initializes a new instance of the Stopwatch class. - */ - constructor(); - - /** - * Gets the elapsed time in this format: - * hrs:mins:secs:ms - */ - readonly elapsed: string; - - /** - * Gets the elapsed time in milliseconds. - */ - readonly elapsedMilliseconds: number; - - /** - * Gets the elapsed time in seconds. - */ - readonly elapsedSeconds: number; - - /** - * Gets the elapsed time in minutes. - */ - readonly elapsedMinutes: number; - - /** - * Gets the elapsed hours in hours. - */ - readonly elapsedHours: number; - - /** - * Gets the isRunning state of the current Stopwatch instance. - * @default false - */ - readonly isRunning: boolean; - - /** - * Initializes a new Stopwatch instance and - * starts measuring elapsed time. - */ - static startNew(): Stopwatch; - - /** - * Starts, or resumes the Stopwatch - * from measuring elapsed time. - */ - start(): void; - - /** - * Stops the Stopwatch from measuring elapsed time. - */ - stop(): void; - - /** - * Stops the Stopwatch and resets the elapsed time to zero. - */ - reset(): void; - - /** - * Stops the Stopwatch, - * resets the elapsed time to zero - * and starts the Stopwatch for measuring elapsed time. - * It is a shortcut for writing - * reset then start. - */ - restart(): void; - - /** - * Stops the Stopwatch and cleans up the intervals. - */ - dispose(): void; - - private getDoubleDigit(num: number): string; -} - -/** - * Simulates an object that represents a time interval. - */ -export class Timespan { - private _milliseconds: number; - private constructor(milliseconds: number); - - /** - * Gets the time interval in milliseconds. - */ - readonly milliseconds: number; - - /** - * Gets the time interval in seconds. - */ - readonly seconds: number; - - /** - * Gets the time interval in minutes. - */ - readonly minutes: number; - - /** - * Gets the time interval in hours. - */ - readonly hours: number; - - /** - * Gets the time interval in days. - */ - readonly days: number; - - /** - * Returns a Timespan that represents a specified number of days. - * @param days The number of days. - */ - static fromDays(days: number): Timespan; - - /** - * Returns a Timespan that represents a specified number of hours. - * @param hours The number of hours. - */ - static fromHours(hours: number): Timespan; - - /** - * Returns a Timespan that represents a specified number of minutes. - * @param minutes The number of minutes. - */ - static fromMinutes(minutes: number): Timespan; - - /** - * Returns a Timespan that represents a specified number of seconds. - * @param seconds The number of seconds. - */ - static fromSeconds(seconds: number): Timespan; - - /** - * Returns a Timespan that represents a specified number of milliseconds. - * @param milliseconds The number of milliseconds. - */ - static fromMilliseconds(milliseconds: number): Timespan; - - /** - * Compares two Timespan objects and - * returns an integer that indicates whether - * the first value is shorter than, equal to, - * or longer than the second value. - * @param t1 The first Timespan to compare. - * @param t2 The second Timespan to compare. - */ - static compare(t1: Timespan, t2: Timespan): 1 | 0 | -1; - - /** - * Returns a boolean value that indicates - * whether two specified instances of Timespan are equal. - * @param t1 The first Timespan to compare. - * @param t2 The second Timespan to compare. - */ - static equals(t1: Timespan, t2: Timespan): boolean; - - /** - * Adds the specified Timespan to this instance. - * @param timespan The Timespan to add. - */ - addMutable(timespan: Timespan): void; - - /** - * Substracts the specified Timespan from this instance. - * @param timespan The Timespan to substract. - */ - substractMutable(timespan: Timespan): void; - - /** - * Returns a new Timespan object whose - * value is the sum of the specified Timespan object and this instance. - * @param timespan The Timespan to add. - */ - add(timespan: Timespan): Timespan; - - /** - * Returns a new Timespan object whose - * value is the difference between the - * specified Timespan object and this instance. - * @param timespan The Timespan to substract. - */ - substract(timespan: Timespan): Timespan; - - /** - * Returns a new Timespan object - * whose value is the negated value of this instance. - */ - negate(): Timespan; -} diff --git a/types/sharp-timer/sharp-timer-tests.ts b/types/sharp-timer/sharp-timer-tests.ts deleted file mode 100644 index a2ec71ac3c..0000000000 --- a/types/sharp-timer/sharp-timer-tests.ts +++ /dev/null @@ -1,32 +0,0 @@ -import { Timer, Stopwatch, Timespan, millisPerSecond } from 'sharp-timer'; - -const millisecondsPerSecond = millisPerSecond; - -// timer test -const timer = new Timer(10); -timer.toString(); -timer.onIntervalElapsing(i => { }); -timer.onIntervalElapsed(() => { - timer.stop(); -}); - -timer.start(); - -// stopwatch test -const stopwatch = Stopwatch.startNew(); - -const intervalId = setInterval(() => { }, 10); - -setTimeout(() => { - clearInterval(intervalId); - stopwatch.dispose(); -}, 100); - -// timespan test -const { - days, - hours, - minutes, - seconds, - milliseconds -} = Timespan.fromDays(2); diff --git a/types/sharp-timer/tsconfig.json b/types/sharp-timer/tsconfig.json deleted file mode 100644 index b7ab232b28..0000000000 --- a/types/sharp-timer/tsconfig.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "compilerOptions": { - "module": "commonjs", - "lib": [ - "es6" - ], - "noImplicitAny": true, - "noImplicitThis": true, - "strictNullChecks": true, - "strictFunctionTypes": true, - "baseUrl": "../", - "typeRoots": [ - "../" - ], - "types": [], - "noEmit": true, - "forceConsistentCasingInFileNames": true - }, - "files": [ - "index.d.ts", - "sharp-timer-tests.ts" - ] -} \ No newline at end of file diff --git a/types/sharp-timer/tslint.json b/types/sharp-timer/tslint.json deleted file mode 100644 index d88586e5bd..0000000000 --- a/types/sharp-timer/tslint.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "extends": "dtslint/dt.json" -} diff --git a/types/sharp-timer/v0/index.d.ts b/types/sharp-timer/v0/index.d.ts deleted file mode 100644 index c5be32264c..0000000000 --- a/types/sharp-timer/v0/index.d.ts +++ /dev/null @@ -1,52 +0,0 @@ -// Type definitions for sharp-timer 0.3 -// Project: https://github.com/afractal/SharpTimer -// Definitions by: Hermes Gjini - afractal -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - -export type ElapsedEvent = () => void; -export type ElapsingEvent = (intervalValue: number) => void; - -export class Timer { - private _enabled; - private _stopped; - private _interval; - private _intervalElapsedEvents; - private _intervalElapsingEvents; - constructor(interval: number); - readonly enabled: boolean; - readonly stopped: boolean; - interval: number; - start(): void; - pause(): void; - resume(): void; - stop(): void; - onIntervalElapsed(intervalElapsedHandler: ElapsedEvent): void; - onIntervalElapsing(intervalElapsingHandler: ElapsingEvent): void; - toString(): string; - private getDoubleDigit(number); - private checkForValidInterval(interval); -} - -export class Stopwatch { - private _isRunning; - private _elapsedMilliseconds; - private _startedTimeInMillis; - private _intervalIds; - private static readonly millisPerSecond; - private static readonly millisPerMinute; - private static readonly millisPerHour; - constructor(); - readonly elapsed: string; - readonly elapsedMilliseconds: number; - readonly elapsedSeconds: number; - readonly elapsedMinutes: number; - readonly elapsedHours: number; - readonly isRunning: boolean; - static startNew(): Stopwatch; - start(): void; - stop(): void; - reset(): void; - restart(): void; - dispose(): void; - private getDoubleDigit(num); -} diff --git a/types/sharp-timer/v0/sharp-timer-tests.ts b/types/sharp-timer/v0/sharp-timer-tests.ts deleted file mode 100644 index e99e550df7..0000000000 --- a/types/sharp-timer/v0/sharp-timer-tests.ts +++ /dev/null @@ -1,10 +0,0 @@ -import { Timer, Stopwatch } from 'sharp-timer'; - -const timer = new Timer(10); - -timer.onIntervalElapsing(i => { }); -timer.onIntervalElapsed(() => { - timer.stop(); -}); - -timer.start(); diff --git a/types/sharp-timer/v0/tsconfig.json b/types/sharp-timer/v0/tsconfig.json deleted file mode 100644 index 423755928a..0000000000 --- a/types/sharp-timer/v0/tsconfig.json +++ /dev/null @@ -1,28 +0,0 @@ -{ - "compilerOptions": { - "module": "commonjs", - "lib": [ - "es6" - ], - "noImplicitAny": true, - "noImplicitThis": true, - "strictNullChecks": true, - "strictFunctionTypes": true, - "baseUrl": "../../", - "typeRoots": [ - "../../" - ], - "paths": { - "sharp-timer": [ - "sharp-timer/v0" - ] - }, - "types": [], - "noEmit": true, - "forceConsistentCasingInFileNames": true - }, - "files": [ - "index.d.ts", - "sharp-timer-tests.ts" - ] -} \ No newline at end of file diff --git a/types/sharp-timer/v0/tslint.json b/types/sharp-timer/v0/tslint.json deleted file mode 100644 index d88586e5bd..0000000000 --- a/types/sharp-timer/v0/tslint.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "extends": "dtslint/dt.json" -}