- 
                Notifications
    You must be signed in to change notification settings 
- Fork 8
          feat: Export getCanvasManager & allow passing it to record()
          #122
        
          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
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.
Can we make this default? (e.g. get rid of build flag?)
39ceb88    to
    c22a3e8      
    Compare
  
    e7e0bc7    to
    8352f64      
    Compare
  
    | 
 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
  
    | OK, I fixed the tests, seems good now. I ended up changing it so that you have to pass in a  | 
- 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)
- 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)
- 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)
- 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.
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 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.