@@ -3,7 +3,7 @@ import { KernelMessage } from '@jupyterlab/services';
3
3
import { IKernel } from '@jupyterlite/kernel' ;
4
4
5
5
import { Console , WebR , Shelter } from 'webr' ;
6
- import { RObject , RList , RCharacter , RLogical } from 'webr' ;
6
+ import { RList , RCharacter , RLogical } from 'webr' ;
7
7
8
8
const webRVersion = "0.3.0-rc.0" ;
9
9
const baseRVersion = "4.3.3" ;
@@ -15,7 +15,7 @@ export class WebRKernel extends BaseKernel {
15
15
init : Promise < void > ;
16
16
#webRConsole: Console ;
17
17
#bitmapCanvas: HTMLCanvasElement ;
18
- #lastRecord: RObject | null = null ;
18
+ #lastPlot: string | null = null ;
19
19
20
20
constructor ( options : IKernel . IOptions ) {
21
21
super ( options ) ;
@@ -190,7 +190,6 @@ export class WebRKernel extends BaseKernel {
190
190
dev.set(${ dev } )
191
191
dev.copy(which = capture_dev)
192
192
dev.off(capture_dev)
193
- recordPlot()
194
193
}, silent = TRUE)
195
194
` ) ;
196
195
const image = capturePlot . images [ 0 ] ;
@@ -199,16 +198,8 @@ export class WebRKernel extends BaseKernel {
199
198
this . #bitmapCanvas. getContext ( 'bitmaprenderer' ) ?. transferFromImageBitmap ( image ) ;
200
199
const plotData = this . #bitmapCanvas. toDataURL ( 'image/png' ) ;
201
200
202
- // Send plot data to client if a new.plot() has been triggered or if
203
- // the plot has changed since last time
204
- const plotChanged = await this . webR . evalRBoolean ( '!identical(a, b)' , {
205
- env : {
206
- a : this . #lastRecord,
207
- b : capturePlot . result ,
208
- }
209
- } )
210
- if ( newPlot || plotChanged ) {
211
- this . #lastRecord = capturePlot . result ;
201
+ if ( newPlot || plotData !== this . #lastPlot) {
202
+ this . #lastPlot = plotData ;
212
203
this . displayData ( {
213
204
data : {
214
205
'image/png' : plotData . split ( "," ) [ 1 ] ,
0 commit comments