Now issuing a *synchronous* save_note() call on page unload. When this call
was done asynchronously, and a Luminotes Firefox window was closed, sometimes save_note() didn't get called. This didn't occur in IE.
This commit is contained in:
parent
818b25e64c
commit
010cbcf01b
|
@ -5,7 +5,7 @@ function Invoker() {
|
|||
// Invoke the given URL with a remote scripting call, providing the data args as an associative
|
||||
// array of key/value pairs. Optionally, the name of a form to scrape for args can also be provided.
|
||||
// http_type should be 'POST' or 'GET'.
|
||||
Invoker.prototype.invoke = function ( url, http_type, args, callback, form, fire_and_forget ) {
|
||||
Invoker.prototype.invoke = function ( url, http_type, args, callback, form, synchronous, fire_and_forget ) {
|
||||
if ( form ) {
|
||||
var form = formContents( getElement( form ) );
|
||||
var arg_names = form[ 0 ];
|
||||
|
@ -18,6 +18,9 @@ Invoker.prototype.invoke = function ( url, http_type, args, callback, form, fire
|
|||
extend( arg_names, keys( args ) );
|
||||
extend( arg_values, values( args ) );
|
||||
|
||||
if ( synchronous )
|
||||
fire_and_forget = true;
|
||||
|
||||
if ( !fire_and_forget ) {
|
||||
if ( this.pending_count == 0 ) {
|
||||
var loading = createDOM( "span", { "class": "status_text" }, "loading" );
|
||||
|
@ -29,7 +32,7 @@ Invoker.prototype.invoke = function ( url, http_type, args, callback, form, fire
|
|||
if ( http_type == 'POST' ) {
|
||||
// HTTP POST
|
||||
request = getXMLHttpRequest();
|
||||
request.open( http_type, url, true );
|
||||
request.open( http_type, url, synchronous != true );
|
||||
request.setRequestHeader( 'Content-Type', 'application/x-www-form-urlencoded' );
|
||||
if ( arg_names.length > 0 )
|
||||
var doc = sendXMLHttpRequest( request, queryString( arg_names, arg_values ) );
|
||||
|
|
|
@ -792,7 +792,7 @@ Wiki.prototype.display_link_pulldown = function ( editor, link ) {
|
|||
}
|
||||
}
|
||||
|
||||
Wiki.prototype.editor_focused = function ( editor, fire_and_forget ) {
|
||||
Wiki.prototype.editor_focused = function ( editor, synchronous ) {
|
||||
if ( editor )
|
||||
addElementClass( editor.iframe, "focused_note_frame" );
|
||||
|
||||
|
@ -808,7 +808,7 @@ Wiki.prototype.editor_focused = function ( editor, fire_and_forget ) {
|
|||
this.display_empty_message();
|
||||
} else {
|
||||
// when switching editors, save the one being left
|
||||
this.save_editor( null, fire_and_forget );
|
||||
this.save_editor( null, null, null, synchronous );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1234,7 +1234,7 @@ Wiki.prototype.compare_versions = function( event, editor, previous_revision ) {
|
|||
this.load_editor( editor.title, editor.id, null, null, editor.closed ? null : editor.iframe );
|
||||
}
|
||||
|
||||
Wiki.prototype.save_editor = function ( editor, fire_and_forget, callback ) {
|
||||
Wiki.prototype.save_editor = function ( editor, fire_and_forget, callback, synchronous ) {
|
||||
if ( !editor )
|
||||
editor = this.focused_editor;
|
||||
|
||||
|
@ -1252,7 +1252,7 @@ Wiki.prototype.save_editor = function ( editor, fire_and_forget, callback ) {
|
|||
editor.mark_clean();
|
||||
if ( callback )
|
||||
callback();
|
||||
}, null, fire_and_forget );
|
||||
}, null, synchronous, fire_and_forget );
|
||||
} else {
|
||||
if ( callback )
|
||||
callback();
|
||||
|
|
Reference in New Issue