Ask Your Question
0

Loaded event for sagecell

asked 2017-02-26 20:36:17 +0100

Shai gravatar image

Hi folks,

I need to call some javascript functions only after a sagecell has been fully loaded on my webpage. I've tried mutation observers and such but nothing is quite right. Does the sagecell emit an event when it has finished doing its thing?

More specifically, I need to resize an outer wrapper-div in the html whenever the sagecell resizes, as it keeps getting cut off. So this would need to work with interacts as well.

edit retag flag offensive close merge delete

Comments

I have accomplished this with a plugin for detecting resize events (github) but I'd still be interested if there is a loaded event emited which I could listen to.

Shai gravatar imageShai ( 2017-02-26 21:45:06 +0100 )edit

1 Answer

Sort by ยป oldest newest most voted
0

answered 2017-02-26 22:22:27 +0100

updated 2017-02-26 22:23:23 +0100

There is an official callback event, but in my testing it fires long before the cell is finished processing. If you want to wait until the cell is fully displayed, you'll need to open a websocket to one of the addresses given at the beginning of this document

https://github.com/sagemath/sagecell/wiki/Session

and then listen for the appropriate response. The document gives sample messages for the entire process of communicating with the cell server, including interacts.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

Stats

Asked: 2017-02-26 20:36:17 +0100

Seen: 289 times

Last updated: Feb 26 '17