📚 JS Docs

This commit is contained in:
ful1e5 2020-09-29 17:43:28 +05:30
parent 427c53679a
commit 5c553f0447
4 changed files with 12 additions and 26 deletions

View file

@ -36,8 +36,7 @@ export class BitmapsGenerator {
/** /**
* Create directory if it doesn't exists. * Create directory if it doesn't exists.
* * @argument dirPath directory `absolute` or `relative` path.
* @param dirPath directory `absolute` or `relative` path.
*/ */
private createDir(dirPath: string) { private createDir(dirPath: string) {
dirPath = path.resolve(dirPath); dirPath = path.resolve(dirPath);
@ -48,9 +47,8 @@ export class BitmapsGenerator {
} }
/** /**
* * @argument browser `puppeteer` browser instance.
* @param browser `puppeteer` browser instance. * @argument content `.svg` file code.
* @param content `.svg` file code.
*/ */
private async getSvgElement( private async getSvgElement(
browser: Browser, browser: Browser,
@ -70,8 +68,7 @@ export class BitmapsGenerator {
/** /**
* Close all pages of `Puppeteer.Browser`. * Close all pages of `Puppeteer.Browser`.
* * @argument browser `puppeteer` browser instance.
* @param browser `puppeteer` browser instance.
*/ */
private async closeAllPages(browser: Browser) { private async closeAllPages(browser: Browser) {
const pages = await browser.pages(); const pages = await browser.pages();
@ -80,9 +77,8 @@ export class BitmapsGenerator {
/** /**
* Generate `static` cursors bitmaps. * Generate `static` cursors bitmaps.
* * @argument browser `puppeteer` browser instance.
* @param browser `puppeteer` browser instance. * @argument spinner `Ora` instance.
* @param spinner `Ora` instance.
*/ */
private async renderStaticCurs(browser: Browser, spinner: Ora) { private async renderStaticCurs(browser: Browser, spinner: Ora) {
for (let [cursor] of Object.entries(this.staticCurs)) { for (let [cursor] of Object.entries(this.staticCurs)) {
@ -104,7 +100,7 @@ export class BitmapsGenerator {
/** /**
* Save animated cursors frames. * Save animated cursors frames.
* @param frames Record of `binary` Buffer. * @argument frames Record of `binary` Buffer.
*/ */
private saveFrames(frames: Frames) { private saveFrames(frames: Frames) {
for (let [cursor, { buffer }] of Object.entries(frames)) { for (let [cursor, { buffer }] of Object.entries(frames)) {
@ -113,11 +109,9 @@ export class BitmapsGenerator {
} }
} }
/** /**
*
* Generate `animated` cursors bitmaps. * Generate `animated` cursors bitmaps.
* * @argument browser `puppeteer` browser instance.
* @param browser `puppeteer` browser instance. * @argument spinner `Ora` instance.
* @param spinner `Ora` instance.
*/ */
private async renderAnimatedCurs(browser: Browser, spinner: Ora) { private async renderAnimatedCurs(browser: Browser, spinner: Ora) {
for (let [cursor] of Object.entries(this.animatedCurs)) { for (let [cursor] of Object.entries(this.animatedCurs)) {
@ -173,7 +167,6 @@ export class BitmapsGenerator {
} }
/** /**
*
* Generate cursors `bitmaps`. * Generate cursors `bitmaps`.
*/ */
public async generate() { public async generate() {

View file

@ -24,15 +24,11 @@ export default class ColoredSvgGenerator {
private animatedCurs: string[]; private animatedCurs: string[];
/** /**
*
* Generate custom color cursor's `.svg`. * Generate custom color cursor's `.svg`.
*
* @param svgDir directory where animated & static cursors located. * @param svgDir directory where animated & static cursors located.
*
* `svgDir` must contain sub-directory `static` and `animated`. * `svgDir` must contain sub-directory `static` and `animated`.
* *
* Example: `svgs/static`, `svgs/animated` * Example: `svgs/static`, `svgs/animated`
*
* @param colors `Colors` for static cursors. * @param colors `Colors` for static cursors.
*/ */
constructor(private readonly themeConfig: ThemeConfig) { constructor(private readonly themeConfig: ThemeConfig) {
@ -42,7 +38,6 @@ export default class ColoredSvgGenerator {
} }
/** /**
*
* Generate `static` cursors .svg file according to `Theme Colors`. * Generate `static` cursors .svg file according to `Theme Colors`.
*/ */
public getStaticCursors(): Cursors { public getStaticCursors(): Cursors {
@ -65,7 +60,6 @@ export default class ColoredSvgGenerator {
} }
/** /**
*
* Generate `animated` cursors .svg file according to `Theme Colors`. * Generate `animated` cursors .svg file according to `Theme Colors`.
*/ */
public getAnimatedCursors(): Cursors { public getAnimatedCursors(): Cursors {

View file

@ -3,9 +3,7 @@ import path from "path";
export default class SvgDirectoryParser { export default class SvgDirectoryParser {
/** /**
*
* Parse the `.svg` files directory. * Parse the `.svg` files directory.
*
* @param svgDir is relative/absolute path, Where source `.svg` files are stored. * @param svgDir is relative/absolute path, Where source `.svg` files are stored.
*/ */
constructor(private svgDir: string) { constructor(private svgDir: string) {
@ -15,7 +13,6 @@ export default class SvgDirectoryParser {
} }
/** /**
*
* Return all static cursors absolute paths from `svgDir/static` directory. * Return all static cursors absolute paths from `svgDir/static` directory.
*/ */
public getStaticCursors(): string[] { public getStaticCursors(): string[] {
@ -37,7 +34,6 @@ export default class SvgDirectoryParser {
} }
/** /**
*
* Return all animated cursors absolute paths from `svgDir/animated` directory. * Return all animated cursors absolute paths from `svgDir/animated` directory.
*/ */
public getAnimatedCursors(): string[] { public getAnimatedCursors(): string[] {

View file

@ -1,6 +1,9 @@
import { BitmapsGenerator } from "./BitmapsGenerator"; import { BitmapsGenerator } from "./BitmapsGenerator";
import { ThemeColors } from "./types"; import { ThemeColors } from "./types";
/**
* Create cursors `bitmaps` from `svg` & `ThemeColors`.
*/
const createBitmaps = async (config: { const createBitmaps = async (config: {
themeColors: ThemeColors; themeColors: ThemeColors;
svgDir: string; svgDir: string;