feat: Export getCanvasManager & allow passing it to record()#122
Merged
feat: Export getCanvasManager & allow passing it to record()#122
getCanvasManager & allow passing it to record()#122Conversation
billyvg
reviewed
Oct 25, 2023
Member
billyvg
left a comment
There was a problem hiding this comment.
Can we make this default? (e.g. get rid of build flag?)
39ceb88 to
c22a3e8
Compare
e7e0bc7 to
8352f64
Compare
Member
Author
Yeah, I guess that makes sense here! 👍 |
size-limit report 📦
|
3c1d07d to
a77e2b9
Compare
0c4a6cd to
f757a63
Compare
Apply formatting changes
968a2fc to
5c9398f
Compare
Member
Author
|
OK, I fixed the tests, seems good now. I ended up changing it so that you have to pass in a |
billyvg
approved these changes
Oct 30, 2023
mydea
added a commit
to getsentry/sentry-javascript
that referenced
this pull request
Oct 31, 2023
- feat: Export getCanvasManager & allow passing it to record() [#122](getsentry/rrweb#122) - feat: Remove hooks related code, which is not used [#126](getsentry/rrweb#126) - feat: Remove plugins related code, which is not used [#123](getsentry/rrweb#123) - feat: Refactor module scope vars & export mirror & `takeFullSnapshot` directly [#113](getsentry/rrweb#113) - fix(rrweb): Fix rule.style being undefined [#121](getsentry/rrweb#121) - ref: Avoid unnecessary cloning of objects or arrays [#125](getsentry/rrweb#125) - ref: Avoid cloning events to add timestamp [#124](getsentry/rrweb#124)
mydea
added a commit
to getsentry/sentry-javascript
that referenced
this pull request
Oct 31, 2023
- feat: Export getCanvasManager & allow passing it to record() [#122](getsentry/rrweb#122) - feat: Remove hooks related code, which is not used [#126](getsentry/rrweb#126) - feat: Remove plugins related code, which is not used [#123](getsentry/rrweb#123) - feat: Refactor module scope vars & export mirror & `takeFullSnapshot` directly [#113](getsentry/rrweb#113) - fix(rrweb): Fix rule.style being undefined [#121](getsentry/rrweb#121) - ref: Avoid unnecessary cloning of objects or arrays [#125](getsentry/rrweb#125) - ref: Avoid cloning events to add timestamp [#124](getsentry/rrweb#124)
mydea
added a commit
to getsentry/sentry-javascript
that referenced
this pull request
Oct 31, 2023
- feat: Export getCanvasManager & allow passing it to record() [#122](getsentry/rrweb#122) - feat: Remove hooks related code, which is not used [#126](getsentry/rrweb#126) - feat: Remove plugins related code, which is not used [#123](getsentry/rrweb#123) - feat: Refactor module scope vars & export mirror & `takeFullSnapshot` directly [#113](getsentry/rrweb#113) - fix(rrweb): Fix rule.style being undefined [#121](getsentry/rrweb#121) - ref: Avoid unnecessary cloning of objects or arrays [#125](getsentry/rrweb#125) - ref: Avoid cloning events to add timestamp [#124](getsentry/rrweb#124)
mydea
added a commit
to getsentry/sentry-javascript
that referenced
this pull request
Oct 31, 2023
- feat: Export getCanvasManager & allow passing it to record() [#122](getsentry/rrweb#122) - feat: Remove hooks related code, which is not used [#126](getsentry/rrweb#126) - feat: Remove plugins related code, which is not used [#123](getsentry/rrweb#123) - feat: Refactor module scope vars & export mirror & `takeFullSnapshot` directly [#113](getsentry/rrweb#113) - fix(rrweb): Fix rule.style being undefined [#121](getsentry/rrweb#121) - ref: Avoid unnecessary cloning of objects or arrays [#125](getsentry/rrweb#125) - ref: Avoid cloning events to add timestamp [#124](getsentry/rrweb#124) Note: With this update, canvas is _always_ excluded, unless we opt in by passing a `getCanvasManager` function to `record()`. We'll provide a way to do this once we have a fully formed canvas story. For now, this will reduce bundle size considerably for all SDK users.
billyvg
pushed a commit
that referenced
this pull request
Apr 26, 2024
This PR exports a new `getCanvasManager()` method which can be used to
dynamically pass a canvas manager, allowing tree shaking.
This also removes the `__RRWEB_EXCLUDE_CANVAS__` build flag - canvas
will _always_ be excluded now by default.
Expected usage:
```js
import { record, getCanvasManager } from '@sentry-internal/canvas';
record({
// other config...
getCanvasManager,
});
```
The idea is that we can expose this somehow (?) from replay, so users
can do e.g.:
```js
import { Replay, getReplayCanvasManager } from '@sentry/browser';
Sentry.init({
integrations: [
new Replay({ canvasManager: getReplayCanvasManager() })
]
});
```
Or something like this, allowing people to opt-in to canvas recording at
runtime, vs requiring a specific build step for it.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR exports a new
getCanvasManager()method which can be used to dynamically pass a canvas manager, allowing tree shaking.This also removes the
__RRWEB_EXCLUDE_CANVAS__build flag - canvas will always be excluded now by default.Expected usage:
The idea is that we can expose this somehow (?) from replay, so users can do e.g.:
Or something like this, allowing people to opt-in to canvas recording at runtime, vs requiring a specific build step for it.