cordova-plugin-mas-core
Version:
Cordova MAS Foundation Plugin
147 lines (119 loc) • 6.65 kB
HTML
<html lang="en">
<head>
<meta charset="utf-8">
<title>JSDoc: Source: MASPluginApplication.js</title>
<script src="scripts/prettify/prettify.js"> </script>
<script src="scripts/prettify/lang-css.js"> </script>
<!--[if lt IE 9]>
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
<link type="text/css" rel="stylesheet" href="styles/prettify-tomorrow.css">
<link type="text/css" rel="stylesheet" href="styles/jsdoc-default.css">
</head>
<body>
<div id="main">
<h1 class="page-title">Source: MASPluginApplication.js</h1>
<section>
<article>
<pre class="prettyprint source linenums"><code>/*
* Copyright (c) 2016 CA, Inc. All rights reserved.
* This software may be modified and distributed under the terms
* of the MIT license. See the LICENSE file for details.
*
*/
var MASPluginUtils = require("./MASPluginUtils"),
MASPluginConstants = require("./MASPluginConstants");
/**
* @class MASPluginApplication
* @hideconstructor
* @classdesc The main class responsible for MASApplication Object Lifecycle Management.
* <table>
* <tr bgcolor="#D3D3D3"><th>MASApplication Construtor</th></tr>
* <tr><td><i>var MASApplication = new MASPlugin.MASApplication();</i></td></tr>
* </table>
*/
var MASPluginApplication = function() {
this.MASAuthenticationStatus = {
MASAuthenticationStatusNotLoggedIn: -1,//MASAuthenticationStatusNotLoggedIn represents that the app has not been authenticated
MASAuthenticationStatusLoginWithUser: 0,//MASAuthenticationStatusLoginWithUser represents that the app has been authenticated with user
MASAuthenticationStatusLoginAnonymously: 1//MASAuthenticationStatusLoginAnonymously represents that the app has been authenticated with client credentials
};
/**
* Checks if application is authenticated.
* @memberOf MASPluginApplication
* @function isApplicationAuthenticated
* @instance
* @param {successCallbackFunction} successHandler user defined success callback that is invoked on success scenario.
* @param {errorCallbackFunction} errorHandler user defined error callback that is invoked on failure scenario.
*/
this.isApplicationAuthenticated = function(successHandler, errorHandler) {
return Cordova.exec(successHandler, errorHandler, "MASPluginApplication", "isApplicationAuthenticated", []);
};
/**
* Returns the authentication status of the application
* @memberOf MASPluginApplication
* @function authenticationStatus
* @instance
* @param {successCallbackFunction} successHandler user defined success callback that is invoked on success scenario.
* @param {errorCallbackFunction} errorHandler user defined error callback that is invoked on failure scenario.
*/
this.authenticationStatus = function(successHandler, errorHandler) {
return Cordova.exec(successHandler, errorHandler, "MASPluginApplication", "authenticationStatus", []);
};
/**
* Launches the selected enterprise Application
* @memberOf MASPluginApplication
* @function launchApp
* @instance
* @param {successCallbackFunction} successHandler user defined success callback that is invoked on success scenario.
* @param {errorCallbackFunction} errorHandler user defined error callback that is invoked on failure scenario.
* @param {string} appId application ID of the app that needs to be launched.
*/
this.launchApp = function(successHandler, errorHandler, appId) {
document.addEventListener("backbutton", MASPluginUtils.onBackKeyPressEvent, false);
return Cordova.exec(successHandler, errorHandler, "MASPluginApplication", "launchApp", [appId]);
};
/**
* Retrieves all the enterprise apps in the form of JSON from the server. It includes both native and web apps
* @memberOf MASPluginApplication
* @function retrieveEnterpriseApps
* @instance
* @param {successCallbackFunction} successHandler user defined success callback that is invoked on success scenario.
* @param {errorCallbackFunction} errorHandler user defined error callback that is invoked on failure scenario.
*/
this.retrieveEnterpriseApps = function(successHandler, errorHandler) {
return Cordova.exec(successHandler, errorHandler, "MASPluginApplication", "retrieveEnterpriseApps", []);
};
/**
* Initializes the Enterprise Browser window and populates it with the native and web apps registered in the MAG server
* @memberOf MASPluginApplication
* @function initEnterpriseBrowser
* @instance
* @param {successCallbackFunction} successHandler user defined success callback that is invoked on success scenario.
* @param {errorCallbackFunction} errorHandler user defined error callback that is invoked on failure scenario.
*/
this.initEnterpriseBrowser = function(successHandler, errorHandler) {
return Cordova.exec(function(result) {
MASPluginUtils.MASPopupUI(MASPluginConstants.MASEnterpriseBrowserPage, result, function() {}, function() {
window.localStorage.removeItem("masCallbackResult");
});
successHandler(true);
}, errorHandler, "MASPluginApplication", "retrieveEnterpriseApps", []);
};
}
module.exports = MASPluginApplication;</code></pre>
</article>
</section>
</div>
<nav>
<h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="MASPlugin.html">MASPlugin</a></li><li><a href="MASPluginApplication.html">MASPluginApplication</a></li><li><a href="MASPluginAuthProviders.html">MASPluginAuthProviders</a></li><li><a href="MASPluginConstants.html">MASPluginConstants</a></li><li><a href="MASPluginDevice.html">MASPluginDevice</a></li><li><a href="MASPluginMAS.html">MASPluginMAS</a></li><li><a href="MASPluginMultipartForm.html">MASPluginMultipartForm</a></li><li><a href="MASPluginSecurityConfiguration.html">MASPluginSecurityConfiguration</a></li><li><a href="MASPluginUser.html">MASPluginUser</a></li><li><a href="MASPluginUtils.html">MASPluginUtils</a></li></ul><h3><a href="global.html">Global</a></h3>
</nav>
<br class="clear">
<footer>
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.3</a> on Tue Feb 18 2020 21:13:36 GMT+0530 (India Standard Time)
</footer>
<script> prettyPrint(); </script>
<script src="scripts/linenumber.js"> </script>
</body>
</html>