Ask Your Question
0

Loaded event for sagecell

asked 8 years ago

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.

Preview: (hide)

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 ( 8 years ago )

1 Answer

Sort by » oldest newest most voted
0

answered 8 years ago

updated 8 years ago

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.

Preview: (hide)
link

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: 8 years ago

Seen: 306 times

Last updated: Feb 26 '17