-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
New doc links + copy for Plugins in Source Editor #4755
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey! Picked on the details a bit. I put #4792 out as a supplement to this, take a look
const defaultSource = ` | ||
// Learn more about plugins at: https://posthog.com/docs/plugins/build/overview |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should leave the initial newline out, as it will appear in the code editor
}, | ||
global: {}, | ||
}> | ||
/* Runs on every event */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This description could be a bit confusing, because we also have onEvent
which is the one intended for running on event. processEvent
should only be used for actually processing/transforming the event in flight.
/* Runs once every full hour */ | ||
// function runEveryHour(meta) { | ||
// const weather = await (await fetch('https://weather.example.api/?city=New+York')).json() | ||
// posthog.capture('weather', { degrees: weather.deg, fahrenheit: weather.us }) | ||
// }` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Feels a bit weird to leave commented-out code in. I think we actually can provide a functioning runEveryHour
by default
@@ -101,9 +102,18 @@ export function PluginSource(): JSX.Element { | |||
{editingSource ? ( | |||
<> | |||
<p> | |||
<a href="https://posthog.com/docs/plugins/build" target="_blank"> | |||
Feeling lost?{' '} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, this question suggests a bit that this is a common feeling with this UX. 😅 Would rather go for a statement here, in the spirit of "BTW you can check that one page out if you want to know more"
Read the documentation. | ||
</a> | ||
<br /> | ||
Happy with your plugin?{' '} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This feels kind of passive aggressive 😅 Maybe a statement too
Changes
To come after PostHog/posthog.com#1467.
Also reverting the basic example to export just the special functions we mention everywhere else in the documentation.
Our starter-kit template now points to a full fledged typescript example, which explains typescript support better.
Checklist