Skip to content

Commit 70d3dd1

Browse files
authored
Merge pull request #223 from martinRenou/opt_client_ready_event
Make client ready event optional
2 parents 89941be + aa48079 commit 70d3dd1

File tree

3 files changed

+9
-4
lines changed

3 files changed

+9
-4
lines changed

.github/workflows/main.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ jobs:
9999
jlab_version: 3
100100
- python: '3.9'
101101
dist: 'ipycanvas*.whl'
102-
jlab_version: 2
102+
jlab_version: 2.3.2
103103

104104
steps:
105105

@@ -128,8 +128,8 @@ jobs:
128128
pip install -vv ${{ matrix.dist }}
129129
130130
- name: Manually install labextension for lab2
131-
if: ${{ matrix.jlab_version }} == 2
132-
run: jupyter labextension install .
131+
if: ${{ matrix.jlab_version }} == 2.3.2
132+
run: jupyter labextension install --debug .
133133

134134
- name: Test installation files
135135
run: |

ipycanvas/canvas.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -254,6 +254,8 @@ class Canvas(_CanvasBase):
254254
_model_name = Unicode('CanvasModel').tag(sync=True)
255255
_view_name = Unicode('CanvasView').tag(sync=True)
256256

257+
_send_client_ready_event = Bool(True).tag(sync=True)
258+
257259
#: (valid HTML color or Gradient or Pattern) The color for filling rectangles and paths. Default to ``'black'``.
258260
fill_style = Union((Color(), Instance(_CanvasGradient), Instance(Pattern)), default_value='black')
259261

src/widget.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -244,6 +244,7 @@ class CanvasModel extends DOMWidgetModel {
244244
height: 500,
245245
sync_image_data: false,
246246
image_data: null,
247+
_send_client_ready_event: true,
247248
};
248249
}
249250

@@ -275,7 +276,9 @@ class CanvasModel extends DOMWidgetModel {
275276
this.on('change:sync_image_data', this.syncImageData.bind(this));
276277
this.on('msg:custom', this.onCommand.bind(this));
277278

278-
this.send({ event: 'client_ready' }, {});
279+
if (this.get('_send_client_ready_event')) {
280+
this.send({ event: 'client_ready' }, {});
281+
}
279282
}
280283

281284
private async drawImageData() {

0 commit comments

Comments
 (0)