If you’ve used jQuery Impromptu before and may be upgrading you should read about these quick changes. For the most part unless you’ve used the last version or two the changes will not affect you. However, this new version adds several helper functions and properly scopes them better. In the past you may have used $.setImpromptuDefaults, but now you just call $.prompt.setDefaults(..); Here are the new/changed functions:
- jQuery.prompt.setDefaults(options)
- jQuery.prompt.setStateDefaults(options)
- jQuery.prompt.getStateContent(stateName)
- jQuery.prompt.goToState(stateName)
- jQuery.prompt.nextState()
- jQuery.prompt.prevState()
- jQuery.prompt.close()
The new functions are to help while working with states. Check out the docs for more details. Also I’ve included a minified version. Although the full version isn’t too big, every little bit counts. Thanks to Kfir Gollan for the suggestions and contributions. Enjoy!
Related posts:




9 Responses
Ben K
23|Mar|2009nice! time to start trying out states me thinks,
I’m gonna have a go at using them as confirmation’s
Jeffrey Gilbert
23|Mar|2009So much has changed since I last wrote source for my stuff using impromtu and jquery. I’m going to love revisiting this stuff later.
trent
23|Mar|2009Hey Jeffery,
The changes were mostly addition of functions. Previously there was only a function to change defaults, this is the only function that has changed to $.prompt.setDefaults(). I believe these new additions will be very helpful!
Ben K
24|Mar|2009Just finished my first prompt with states, it looks great, and is working well!
for reference,
i use ajax to pull in the state html content
there is a default_state and a delete_confirm state
because ajax is asynchronous i always return true from the delete_confirm state
and use the callback on the ajax call with $.prompt.close(); to close the prompt on a successful delete
the setStateContent function mentioned by Kfir would be a useful adition to do server side validation
thanks for your work Trent!
Ben K
24|Mar|2009a state change speed variable would be great too!
trent
24|Mar|2009Thats great! I always like hearing success stories! I will add this to my todo list for an option state change speed.
Kfir Gollan
25|Mar|2009Hey Trent,
I’m glad to see that you’ve added so many improvements to Impromptu and I’d like to thank you for that.
One problem that arised from all the new additions is the size of the docs document. The docs document has become too large and it’ll be nice to split it into a few separate pages.
I have a few more changes in mind so I’ll post a comment with some changes soon, this time I’ll remember to make a list of the changes.
Best regards,
Kfir
trent
25|Mar|2009Hey Kfir,
I too have noticed this. I’ve been thinking on how to redo the docs to be more resourceful. I would like to add a section for upcoming change proposals, who’s using impromptu, examples, docs, etc.. I’m pleased that Impromptu has been an active project and is always improving, so suggestions are always welcome.
Kfir Gollan
25|Mar|2009I’ve changed some minor, but still important, details.
Link: http://pastebin.com/m5d3f68b8
List of changes:
local changes:
1 – line: 87, if true or undefined is returned from the submit function, close the prompt
2 – line: 255, there is no need to use $(this) when we have $next
3 – line: 263, there is no need to use $(this) when we have $next
Global changes:
1 – jQuery objects get a $ prefix, for example $window = $(window) and not window = $(window)
2 – jslint structure
Another change that can make the code more readable is using closure for private functions instead of variables
Best regards,
Kfir