Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow refreshBlocks() to specify extension #228

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 14 additions & 11 deletions src/extension-support/extension-manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -277,19 +277,22 @@ class ExtensionManager {

/**
* Regenerate blockinfo for any loaded extensions
* @param {string=} optExtensionId Optional extension ID for refreshing
* @returns {Promise} resolved once all the extensions have been reinitialized
*/
refreshBlocks () {
const allPromises = Array.from(this._loadedExtensions.values()).map(serviceName =>
dispatch.call(serviceName, 'getInfo')
.then(info => {
info = this._prepareExtensionInfo(serviceName, info);
dispatch.call('runtime', '_refreshExtensionPrimitives', info);
})
.catch(e => {
log.error('Failed to refresh built-in extension primitives', e);
})
);
refreshBlocks (optExtensionId) {
const refresh = serviceName => dispatch.call(serviceName, 'getInfo')
.then(info => {
info = this._prepareExtensionInfo(serviceName, info);
dispatch.call('runtime', '_refreshExtensionPrimitives', info);
})
.catch(e => {
log.error('Failed to refresh built-in extension primitives', e);
});
if (optExtensionId && this._loadedExtensions.has(optExtensionId)) {
return refresh(this._loadedExtensions.get(optExtensionId));
}
const allPromises = Array.from(this._loadedExtensions.values()).map(refresh);
return Promise.all(allPromises);
}

Expand Down