Skip to content

Commit

Permalink
jsdocs
Browse files Browse the repository at this point in the history
  • Loading branch information
adamdbradley committed Sep 14, 2021
1 parent 9f2be41 commit 5320238
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 20 deletions.
20 changes: 0 additions & 20 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ Partytown is a `5kb` library to help relocate resource intensive scripts into a
- [React](#react)
- [Vanilla](#vanilla)
- [Config](#config)
- [Debugging](#debugging)
- [Distribution](#distribution)
- [Development](https://github.com/BuilderIO/partytown/blob/main/DEVELOPER.md#local-development)
- [Installation](https://github.com/BuilderIO/partytown/blob/main/DEVELOPER.md#installation)
Expand Down Expand Up @@ -270,25 +269,6 @@ React Forward Config:
<Partytown forward={['dataLayer.push', '_hspt.push', 'intercom']}>
```

### Debugging

When using the `partytown.debug.js` file there is a set of default debug logs available that print in the console. You can also opt-in to list out even more verbose logs that may help to debug scripts.

```html
<script>
partytown = {
logCalls: true,
logGetters: true,
logSetters: true,
logImageRequests: true,
logScriptExecution: true,
logStackTraces: true,
};
</script>
```

> Note that debug logs and configuration is not available in the `partytown.js` version.
### Distribution

The distribution comes with multiple files:
Expand Down
36 changes: 36 additions & 0 deletions src/lib/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -204,13 +204,49 @@ export interface SerializedNodeList extends SerializedInstance {
}

export interface PartytownConfig {
/**
* Partytown scripts are not inlined and not minified.
*/
debug?: boolean;
/**
* Many third-party scripts provide a global variable which user code calls
* in order to send data to the service. For example, Google Tag Manager uses
* a [Data Layer](https://developers.google.com/tag-manager/devguide) array,
* and by pushing data to the array, the data is then sent on to GTM. Because
* we're moving third-party scripts to a web worker, the main thread needs to
* know which variables to patch first, and when Partytown loads, it can then
* forward the event data on to the service.
*
* Below is an example of Google Tag Manager, Hubspot and Intercom forward configs:
*
* ```js
* ['dataLayer.push', '_hspt.push', 'intercom']
* ```
*/
forward?: PartytownForwardConfig;
/**
* Log method calls (debug mode required)
*/
logCalls?: boolean;
/**
* Log getter calls (debug mode required)
*/
logGetters?: boolean;
/**
* Log setter calls (debug mode required)
*/
logSetters?: boolean;
/**
* Log image requests (debug mode required)
*/
logImageRequests?: boolean;
/**
* Log script executions (debug mode required)
*/
logScriptExecution?: boolean;
/**
* Log stack traces (debug mode required)
*/
logStackTraces?: boolean;
}

Expand Down

1 comment on commit 5320238

@vercel
Copy link

@vercel vercel bot commented on 5320238 Sep 14, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.