mirror of
https://github.com/scratchfoundation/scratch-vm.git
synced 2025-08-28 22:30:40 -04:00
Fix lint errors.
This commit is contained in:
parent
57d3e564e2
commit
1910968b13
3 changed files with 12 additions and 12 deletions
|
@ -551,11 +551,11 @@ class Runtime extends EventEmitter {
|
|||
*/
|
||||
_buildMenuForScratchBlocks (menuName, menuItems, categoryInfo) {
|
||||
const menuId = this._makeExtensionMenuId(menuName, categoryInfo.id);
|
||||
var options = null;
|
||||
let options = null;
|
||||
if (typeof menuItems === 'function') {
|
||||
options = function () {
|
||||
options = function () {
|
||||
return menuItems();
|
||||
}
|
||||
};
|
||||
} else {
|
||||
options = menuItems.map(item => {
|
||||
switch (typeof item) {
|
||||
|
|
|
@ -250,22 +250,22 @@ class ExtensionManager {
|
|||
/**
|
||||
* Prepare extension menus. e.g. setup binding for dynamic menu functions.
|
||||
* @param {string} serviceName - the name of the service hosting this extension block
|
||||
* @param {Array.<MenuInfo>} menuInfo - the menu defined by the extension.
|
||||
* @param {Array.<MenuInfo>} menus - the menu defined by the extension.
|
||||
* @returns {Array.<MenuInfo>} - a menuInfo object with all preprocessing done.
|
||||
* @private
|
||||
*/
|
||||
_prepareMenuInfo (serviceName, menus) {
|
||||
var menuNames = Object.getOwnPropertyNames(menus);
|
||||
const menuNames = Object.getOwnPropertyNames(menus);
|
||||
for (let i = 0; i < menuNames.length; i++) {
|
||||
var item = menuNames[i];
|
||||
const item = menuNames[i];
|
||||
// If the value is a string, it should be the name of a function in the
|
||||
// extension object to call to populate the menu whenever it is opened.
|
||||
// Set up the binding for the function object here so
|
||||
// we can use it later when converting the menu for Scratch Blocks.
|
||||
if (typeof menus[item] === 'string') {
|
||||
const serviceObject = dispatch.services[serviceName];
|
||||
const menuFunc = serviceObject[menus[item]].bind(serviceObject);
|
||||
menus[item] = menuFunc;
|
||||
const serviceObject = dispatch.services[serviceName];
|
||||
const menuFunc = serviceObject[menus[item]].bind(serviceObject);
|
||||
menus[item] = menuFunc;
|
||||
}
|
||||
}
|
||||
return menus;
|
||||
|
|
|
@ -25,7 +25,7 @@ class TestInternalExtension {
|
|||
],
|
||||
menus: {
|
||||
simpleMenu: this._buildAMenu(),
|
||||
dynamicMenu: '_buildDynamicMenu',
|
||||
dynamicMenu: '_buildDynamicMenu'
|
||||
}
|
||||
};
|
||||
}
|
||||
|
@ -34,12 +34,12 @@ class TestInternalExtension {
|
|||
this.status.goCalled = true;
|
||||
}
|
||||
|
||||
_buildAMenu() {
|
||||
_buildAMenu () {
|
||||
this.status.buildMenuCalled = true;
|
||||
return ['abcd', 'efgh', 'ijkl'];
|
||||
}
|
||||
|
||||
_buildDynamicMenu() {
|
||||
_buildDynamicMenu () {
|
||||
this.status.buildDynamicMenuCalled = true;
|
||||
return [1, 2, 3, 4, 6];
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue