Skip to content
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

Allow programatic save #39

Open
pehrlich opened this issue Apr 12, 2014 · 1 comment
Open

Allow programatic save #39

pehrlich opened this issue Apr 12, 2014 · 1 comment

Comments

@pehrlich
Copy link

For example, I would like to have it save before unload the page every time, so that I can rapidly debug changes without having to save and resume settings manually.

Unfortunately, the following code doesn't work:

window.onbeforeunload = ->
  gui.save()

It gives the error:

Uncaught TypeError: Cannot read property 'selectedIndex' of undefined dat.gui.js:2854
markPresetModified dat.gui.js:2854
dat.GUI.dat.gui.GUI.common.extend.save dat.gui.js:2261
window.onbeforeunload

@stellatigre
Copy link

This issue still occurs in the latest build - this functionality can be invoked by firing the fake click event on the save button:

function saveDatGUI() {
    dat.dom.dom.fakeEvent($('.cr .button')[0], 'click');
}

but that feels hacky. This functionality would be useful in writing tests which involve a datgui component.
If it's deemed not an issue, perhaps close this ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants