You need to use EasyEDA editor to create some projects before publishing
Extensions installation UX issues: Getting rid of useless ExtentionID field
797 5
turbobabr 4 years ago
![image.png](//image.easyeda.com/pullimage/vCYUDKh74JaWsHo2TEak6Uf1f3KuO3cD6KE1h5VW.png) I'm really curious - why on earth there's a "Extension ID" text field in the "Load Extension" dialog? 1. For people who develop extensions - it's just a super annoying step to do every time during an updating process. 2. Moreover, it's even worse for the end users who just want to install a 3rd party extension developed by someone else. This field has no clues or suggestions what should be put into it and why it's required. So the whole thing looks incredibly confusing. I might be wrong\, but I tend to think that it can't be excluded from that dialog and from the process of installation\. An extension's identifier could be easily specified in the \`manifest\.json\` file by a developer using \`reverse dns notation\` which is a standard for all sort of bundles\, modules\, etc: ![image.png](//image.easyeda.com/pullimage/VIemaFvewUiCwDS639BG0H2KZBNlyu9TsnwL6hiz.png) You have the entire control over that manifest file and the identifier could be easily fetched from \`manifest\.json\` and used later for the internal installation routines\.
Comments
andreasbernhofer 4 years ago
Completely agree... Maybe one benefit could be to have the same extension multiple times but in different versions or with different configuration, because if I understood it correct, everything inside an extension is scoped with that extension id. However, you can control the value for your extension, so the user doesn't have to care much. IMHO the ID is parsed using a regex from the javascript file. I wrote a comment about that here: [https://github.com/xsrf/easyeda-extension-example/blob/master/extension/main.js#L10](https://github.com/xsrf/easyeda-extension-example/blob/master/extension/main.js#L10)
Reply
andreasbernhofer 4 years ago
Well.. Ignore the first part I wrote. Not everything is scoped automatically. e.g. when you create your own HTML you have to take care about the ids yourself. Also, the registered commands that actually contain the ID as part of their name may not be scoped (didn't test that but I'm pretty sure). So while it may be possible to write an extension that can be imported multiple times, that's not the regular case, I guess...
Reply
andreasbernhofer 4 years ago
Oh, you don't even have to register a command. I guess the JS source is parsed for any `extension-(\w+)-.+` and the one that occurs most is taken ;) When I prefiy my extension code with ``` /* extension-testone-test extension-testtwo-test extension-testtwo-test extension-testthree-test */ ``` The extension ID becomes `testtwo` when imported.
Reply
turbobabr 4 years ago
@andreasbernhofer I can't come up with any use case for keeping two or more versions of the same extension\, thus I tend to think that the manual "Extension ID" is just a \`"development artifact"\` that was introduced years ago and left as is\, since no one cared about it till this moment\. :\)
Reply
andreasbernhofer 3 years ago
I'd also suggest that you add a way to set the extension id within the `manifest.json` and provide an API to get it, like `api('getExtensionId')` and maybe also `api('getInstance')` which provides a reference to `easyeda.extension.instances[extensionId]`. Of course, for backwards compatibility, if the Id is not set in the manifest it should be searched within the scripts as usual. For the UI, the input field is quite dangerous at the moment. It allows you to change the extensions ID. But some extensions assume a hardcoded extension ID because there is no (official) way to get the own extension ID at the moment. Since things like commands aren't scoped with the extension by default, multiple instances of the same extension would usually break anyways. I'd suggest hiding the field for now and just creating random extension ids for extensions that don't provide an Id within the script or manifest.
Reply
Login or Register to add a comment
goToTop
你现在访问的是EasyEDA海外版,建议访问速度更快的国内版 https://lceda.cn(需要重新注册)
如果需要转移工程请在个人中心 - 工程 - 工程高级设置 - 下载工程,下载后在https://lceda.cn/editor 打开保存即可。
有问题联系QQ 3001956291 不再提醒
svg-battery svg-battery-wifi svg-books svg-more svg-paste svg-pencil svg-plant svg-ruler svg-share svg-user svg-logo-cn svg-double-arrow -mockplus- -mockplus- -mockplus- -mockplus- -mockplus- -mockplus- -mockplus- -mockplus-@1x -mockplus-

Cookie Notice

Our website uses essential cookies to help us ensure that it is working as expected, and uses optional analytics cookies to offer you a better browsing experience. To find out more, read our Cookie Notice