2020-12-16 06:10:41 +03:30
|
|
|
'use strict';
|
2012-05-28 18:39:32 -07:00
|
|
|
|
2020-11-23 13:24:19 -05:00
|
|
|
const pluginUtils = require('./shared');
|
|
|
|
const defs = require('./plugin_defs');
|
2012-05-28 18:39:32 -07:00
|
|
|
|
|
|
|
exports.baseURL = '';
|
|
|
|
|
2020-12-16 06:10:41 +03:30
|
|
|
exports.update = (cb) => {
|
2012-05-28 18:39:32 -07:00
|
|
|
// It appears that this response (see #620) may interrupt the current thread
|
|
|
|
// of execution on Firefox. This schedules the response in the run-loop,
|
|
|
|
// which appears to fix the issue.
|
2020-12-16 06:10:41 +03:30
|
|
|
const callback = () => setTimeout(cb, 0);
|
|
|
|
|
2021-02-15 08:52:38 +01:00
|
|
|
jQuery.getJSON(
|
|
|
|
`${exports.baseURL}pluginfw/plugin-definitions.json?v=${clientVars.randomVersionString}`
|
|
|
|
).done((data) => {
|
2020-09-06 15:27:18 -04:00
|
|
|
defs.plugins = data.plugins;
|
|
|
|
defs.parts = data.parts;
|
2020-11-23 13:24:19 -05:00
|
|
|
defs.hooks = pluginUtils.extractHooks(defs.parts, 'client_hooks');
|
2020-09-06 15:27:18 -04:00
|
|
|
defs.loaded = true;
|
2012-05-28 18:39:32 -07:00
|
|
|
callback();
|
2020-12-16 06:10:41 +03:30
|
|
|
}).fail((err) => {
|
2020-11-23 13:24:19 -05:00
|
|
|
console.error(`Failed to load plugin-definitions: ${err}`);
|
2020-06-07 12:01:14 +01:00
|
|
|
callback();
|
|
|
|
});
|
2012-05-28 18:39:32 -07:00
|
|
|
};
|