Comments
This commit is contained in:
parent
2ae354530e
commit
8436f23e05
|
@ -30,7 +30,9 @@ export function appNavigate(uri: ?string) {
|
|||
* state.
|
||||
* @param {Object} newLocation - The location URI to navigate to. The value
|
||||
* cannot be undefined and is assumed to have all properties such as
|
||||
* {@code host} and {@code room} defined values.
|
||||
* {@code host}, {@code contextRoot}, and {@code room} defined. Depending on the
|
||||
* property, it may have a value equal to {@code undefined} and that may be
|
||||
* acceptable.
|
||||
* @private
|
||||
* @returns {void}
|
||||
*/
|
||||
|
@ -55,8 +57,9 @@ function _appNavigateToMandatoryLocation(
|
|||
}
|
||||
|
||||
/**
|
||||
* Notifies that an attempt to load the config(uration) of domain has
|
||||
* completed.
|
||||
* Notifies that an attempt to load a config(uration) has completed. Due to
|
||||
* the asynchronous native of the loading, the specified <tt>config</tt> may
|
||||
* or may not be required by the time the notification arrives.
|
||||
*
|
||||
* @param {string|undefined} err - If the loading has failed, the error
|
||||
* detailing the cause of the failure.
|
||||
|
@ -65,6 +68,10 @@ function _appNavigateToMandatoryLocation(
|
|||
* @returns {void}
|
||||
*/
|
||||
function configLoaded(err, config) {
|
||||
// FIXME Due to the asynchronous native of the loading, the specified
|
||||
// config may or may not be required by the time the notification
|
||||
// arrives.
|
||||
|
||||
if (err) {
|
||||
// XXX The failure could be, for example, because of a
|
||||
// certificate-related error. In which case the connection will
|
||||
|
@ -186,6 +193,7 @@ export function appWillUnmount(app) {
|
|||
*
|
||||
* @param {Object} location - The location URI which specifies the host to load
|
||||
* the config.js from.
|
||||
* @private
|
||||
* @returns {Promise<Object>}
|
||||
*/
|
||||
function _loadConfig(location: Object) {
|
||||
|
|
|
@ -67,7 +67,7 @@ export function loadConfig(host: string, path: string = 'config.js') {
|
|||
.then(() => {
|
||||
const { config } = window;
|
||||
|
||||
// We don't want to pollute global scope.
|
||||
// We don't want to pollute the global scope.
|
||||
window.config = undefined;
|
||||
|
||||
if (typeof config !== 'object') {
|
||||
|
@ -82,9 +82,9 @@ export function loadConfig(host: string, path: string = 'config.js') {
|
|||
throw err;
|
||||
});
|
||||
} else {
|
||||
// Return config.js file from global scope. We can't use the version
|
||||
// that's being used for the React Native app because the old/current
|
||||
// Web app uses config from the global scope.
|
||||
// Return "the config.js file" from the global scope - that is how the
|
||||
// Web app on both the client and the server was implemented before the
|
||||
// React Native app was even conceived.
|
||||
promise = Promise.resolve(window.config);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,11 +1,10 @@
|
|||
/**
|
||||
* Loads a script from a specific URL. React Native cannot load a JS
|
||||
* file/resource/URL via a <script> HTML element, so the implementation
|
||||
* fetches the specified src as plain text using fetch() and then
|
||||
* evaluates the fetched string as JavaScript code (i.e. via the {@link eval}
|
||||
* function).
|
||||
* fetches the specified <tt>url</tt> as plain text using {@link fetch()} and
|
||||
* then evaluates the fetched string as JavaScript code (using {@link eval()}).
|
||||
*
|
||||
* @param {string} url - The absolute URL from the which the script is to be
|
||||
* @param {string} url - The absolute URL from which the script is to be
|
||||
* (down)loaded.
|
||||
* @returns {void}
|
||||
*/
|
||||
|
@ -20,7 +19,6 @@ export function loadScript(url) {
|
|||
default:
|
||||
throw response.statusText;
|
||||
}
|
||||
|
||||
})
|
||||
.then(responseText => {
|
||||
eval.call(window, responseText); // eslint-disable-line no-eval
|
||||
|
|
Loading…
Reference in New Issue