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