logout( ) method (JSDOSession class)
- Last Updated: June 14, 2019
- 3 minute read
- OpenEdge
- Version 13.0
- Documentation
Terminates the login session on the web
application managed by the current JSDOSession object
and leaves the object available to start a new login session with a call to its login( ) method.
This method throws an error if the underlying communication layer throws an error.
On a successful logout, the JSDOSession
object sets its connected property to false. If the logout fails, the object leaves its connected property set to true, unless the
failure happened because the app cannot access the server.
Once logout( ) is executed, no further
communication (other than a login( ) call) can occur
between the mobile app and the server using this JSDOSession object. However, any catalogs loaded in the object remain available
to create and maintain JSDOs, though these JSDOs cannot make requests to the server until a
new login session is established for the object (including for anonymous access).
This method is always executed asynchronously and returns results in callbacks that you register using methods of a Promise object returned as the method value.
JSDOSession
instance, you can call invalidate( ) (instead of logout( )) to permanently disable the instance and prevent any
additional calls to its login( ) method. If you want to
permanently disable all current JSDOSession instances, you
can also call invalidateAllSessions( ) instead.Return type: jQuery Promise
Applies to: progress.data.JSDOSession class
Syntax
|
Promise method signatures
jQuery Promise objects define methods that register a callback function
with a specific signature. The callback signatures depend on the method that returns the
Promise. Following are the signatures of callbacks registered by methods in any Promise
object that logout( ) returns:
Syntax:
|
- promise
- A reference to the Promise object that is returned as the value of the
logout( )method. For more information on Promises, see the notes on Promises in the description of the progress.data.JSDOSession class. - session
- A reference to the
JSDOSessionobject on whichlogout( )was called. - result
- A constant indicating the overall result of the call that can have
one of the following values:
-
progress.data.Session.SUCCESS— The session logout completed successfully. -
progress.data.Session.GENERAL_FAILURE— The session logout failed because of some error.
Note: It is not always necessary to test the value of result in a Promise method callback for thelogout( )method, especially if the callback is registered usingpromise.done( )orpromise.fail( ), where the callback always executes with the same value (progress.data.Session.SUCCESSandprogress.data.Session.GENERAL_FAILURE, respectively). -
- info
- A JavaScript object that can have the following properties:
errorObject— An error object thrown while attempting to terminate the login session.xhr— A reference to the XMLHttpRequest object sent to the web server to terminate the login session.
Detailed logout behavior
When this method terminates the associated login session, the JSDOSession object can be re-used to start a new session using
the same serviceURI and authenticationModel configuration
settings originally passed to the object's constructor. The JSDOSession object's properties retain their values from the previous login
session, with the following exceptions:
-
clientContextIdis reset tonull. -
loginHttpStatusis reset tonull. -
loginResultis reset tonull. -
userNameis reset tonull.
Existing JSDOs and catalog information are not affected by a successful
execution of logout( ). However, any attempt to call
addCatalog( ) or a JSDO method that requires
contacting the server results in an error object being thrown.
Example
The following code fragment calls the logout( ) method on the JSDOsession object,
session. This example uses try and catch blocks in case logout( ) throws an unexpected exception, and displays messages
returned from Promise handlers accordingly:
|
See also:
invalidate( ) method, invalidateAllSessions( ) stand-alone function, login( ) method (JSDOSession class), offline event, online event