Skip to content

Commit

Permalink
chore: docs, size limit
Browse files Browse the repository at this point in the history
  • Loading branch information
andrepolischuk committed Aug 14, 2024
1 parent 6948d6d commit f161fcf
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 1 deletion.
12 changes: 12 additions & 0 deletions .size-limit.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,20 @@
"path": "packages/session-storage/dist/index.js",
"limit": "290 B"
},
{
"path": "packages/tns-counter/dist/index.js",
"limit": "450 B"
},
{
"path": "packages/top-100/dist/index.js",
"limit": "4.1 KB"
},
{
"path": "packages/url/dist/index.js",
"limit": "675 B"
},
{
"path": "packages/yandex-metrica/dist/index.js",
"limit": "4.0 B"
}
]
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,10 @@ Common utils used by Rambler team
- [@rambler-tech/lhci-report](packages/lhci-report)
- [@rambler-tech/local-storage](packages/local-storage)
- [@rambler-tech/session-storage](packages/session-storage)
- [@rambler-tech/tns-counter](packages/tns-counter)
- [@rambler-tech/top-100](packages/top-100)
- [@rambler-tech/url](packages/url)
- [@rambler-tech/yandex-metrica](packages/yandex-metrica)

## Contributing

Expand Down
8 changes: 8 additions & 0 deletions packages/top-100/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,12 @@ export interface Top100Options {
params?: Record<string, any>
}

/** Top 100 counter */
export class Top100 {
/** Counter options */
options: Top100Options

/** Promise that resolves when counter is ready */
ready: Promise<void>

constructor(options: Top100Options) {
Expand Down Expand Up @@ -84,18 +88,22 @@ export class Top100 {
} catch {}
}

/** Send custom vars */
async sendCustomVars(params: Record<string, any>) {
await this.run('sendCustomVars', params)
}

/** Track page view */
async trackPageview() {
await this.run('trackPageview')
}

/** Track event */
async trackEvent(eventName: string, eventData: Record<string, any>) {
await this.run('trackEvent', eventName, eventData)
}

/** Update counter options */
async updateOptions(options: Record<string, any>) {
await this.run('updateOptions', options)
}
Expand Down
8 changes: 7 additions & 1 deletion packages/yandex-metrica/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,12 @@ export interface YandexMetricaOptions {
params?: Record<string, any>
}

/** Yandex Metrica */
/** Yandex Metrica counter */
export class YandexMetrica {
/** Counter options */
options: YandexMetricaOptions

/** Promise that resolves when counter is ready */
ready: Promise<void>

constructor(options: YandexMetricaOptions) {
Expand Down Expand Up @@ -74,14 +77,17 @@ export class YandexMetrica {
} catch {}
}

/** Track hit */
async hit(params: Record<string, any>) {
await this.run('hit', params)
}

/** Set params */
async setParams(params: Record<string, any>) {
await this.run('params', params)
}

/** Reach goal */
async reachGoal(...args: any[]) {
await this.run('reachGoal', ...args)
}
Expand Down
5 changes: 5 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -8760,6 +8760,11 @@ w3c-xmlserializer@^4.0.0:
dependencies:
xml-name-validator "^4.0.0"

wait-for-target@^0.3.0:
version "0.3.0"
resolved "https://registry.yarnpkg.com/wait-for-target/-/wait-for-target-0.3.0.tgz#1e2c2453e656dff3161ae1cdc1213fede7a235a4"
integrity sha512-PgcDZJbWRXxGb0Cm0YyufPq3Crx7ZfqAIQaxaJLOoJSiHKFtkH7wy4R5M9DZxBEnDCPJdTYyxTR+8+JzP8JlIg==

walker@^1.0.8:
version "1.0.8"
resolved "https://registry.yarnpkg.com/walker/-/walker-1.0.8.tgz#bd498db477afe573dc04185f011d3ab8a8d7653f"
Expand Down

0 comments on commit f161fcf

Please sign in to comment.