Skip to content

Instantly share code, notes, and snippets.

@AhsanAyaz
Created February 25, 2018 09:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save AhsanAyaz/d2c2f2951d406261d41f833ace9c3ce3 to your computer and use it in GitHub Desktop.
Save AhsanAyaz/d2c2f2951d406261d41f833ace9c3ce3 to your computer and use it in GitHub Desktop.
Watch Service used with the Stop Watch Box Component I built using Stencil
export class WatchService {
/**
* @author Ahsan Ayaz
* @desc Calculates the units and sets in string format.
* @param unit value of the unit in numbers
* @return {string} the string representation of the unit's value with at least 2 digits
*/
getTimeString(unit: number): string {
return (unit ? (unit > 9 ? unit : "0" + unit) : "00").toString();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment