-
-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Midori on Pi Zero doesnt support ES6 Arrow Functions (line 51) #694
Comments
Changed the line to the following at all is back to working now.
|
thats not working correctly because in the function this has a new context, you have to save the var this first like it is in line 57 |
oooh sorry! I had that in mine, forgot to add it in there above in the copy and paste. Thanks for noticing! |
Interesting. I thinks it's a good point to discuss if we fully switch to ES6 or complete remove all ES6 functions to support older versions. |
@MichMich We could use a middle ground. Convert the project to all ES6, add Webpack with Uglify, Concat and Babel, and then run it through there. |
@nhubbard I thought about this a while back, but it would make the project MUCH more complex. Since you end up with compiled files and source files. And while this might be solvable, it is a HUGE issue for issue for people starting with development. |
@MichMich @nhubbard that does sound as though it would make it quite a bit more complex. I was thinking more along the lines of removing ES6 functions or just labelling the modules to say whether they are compatible with older browsers or not. At least that way those in the know would easily be able to update them before installing...though I suppose this second way doesnt make it very end user friendly. Suppose the answer would revolve around what users you are catering for. |
Well, the "support focus" is on Electron. So in that case, ES6 should be supported. But I do understand the issue with Midori. |
a research for es6 compatible pi zero browser could solve the problematic |
@fewieden I don't think the issue is that the browsers arent compatible because they are, the issue is using some of the other browsers slows the pi down to the point its not very usable. Midori seems to be the only one (that I've found...not saying there arent others) works. I suppose reaching out to Midori to see if they will support ES6 is another option. |
@MichMich I agree, it would make the project more complicated. |
lets see the response on this https://answers.launchpad.net/midori/+question/452559 |
@fewieden yeah I just opened that after my previous message hoping it would get a response. Maybe should have called it a bug citing the errors from the code run from a module here? |
@MichMich Could we use a custom polyfill like this? try {
// arrow function test, or
// attempt to load our scripts using the "create new script and add it to the DOM" method
} catch (e if e instanceof SyntaxError) {
// use "text/babel" as type with babel-standalone and load it by making a new element
} |
@nhubbard It's all so over complicated. Maybe we should make an overview of the ES6 things we use to see if it's nessecery at all. |
Node can handle es6, it's just about the default module frontend stuff. Most of the time just the use of arrow functions which can be replaced by |
@MichMich I'll try and come up with a Webpack-based solution that may or may not be less complicated... it may be the same. |
@nhubbard Don't put to much effort in it. I'd rather use vanilla JS without any script generation. |
Doesn't look like Midori will support this in the future and based on this comment #813 (comment) Do we bother on supporting midori or not? |
Unless there's a more lightweight browser than MM nothing else runs well on the pi zero. Would be cutting out a lot of people, especially now that the new pi zero w/ wifi is out also. If all you wanted to run was MM a Pi3 is a bit over the top. |
Given the fact that the tutorial "How I got my Magic Mirror working on a Raspberry Pi 0 (zero)" alone has 24.5 k views in the MM forum, I think there are a lot of people using the Pi Zero. I would understand to use the arrow syntax if it would make a huge performance or code readability benefit or if the change would be complicated. However, this seems not to be the case here.
by
(I don't know JS, but it seems to work) and allow them to see the compliments. Of course this does not solve all issues (there might be other unsupported features in other modules...) but at least I don't see any drawbacks for making this change. |
@HawkingJan Is there anything else you changed besides this? I made the replacement you suggested but can't get a remote file from loading, if I revert back to the code using arrow notation everything works as expected. |
I don't remember making more changes to the code, this is also confirmed by the following difference by git (I don't expect the end of line change to have an effect).
I can see the compliments on the mirror and if I access the page "remote" from my regular PC. |
the code of @HawkingJan is incorrect, but still works without using a remoteFile, because the critical code doesn't get reached. It should be something like this (untested), as I already mentioned here #694 (comment).
|
@fewieden thanks so much! I can confirm that the code above does indeed load the compliments from the remote file. I commented out all compliments on the compliments.js file, magic mirror starts up as "undefined" and then compliments from the remote file load. |
As I'm not using a remote file, I didn't notice that it creates problems (and it only worked because I got rid of the arrow function). So thanks for pointing this out. The code proposed by fewieden also works for me. Can somebody check this into the repository? |
Closed due to inactivity. Feel free to reopen. |
Following this issue MagicMirrorOrg#694 it seems that the Midori Browser does not recoginize ES6 syntax. Further, the use of 'var' is seen throughout the calendar module excpet on line 439, where the error is reported
* Fixed coloredSymbolOnly * Changed weatherforecast to use dt_txt field * New calendar display format with date headers for days and times listed next to events for that date IE: Sunday, May 1st 2:00 pm Soccer 4:00 pm Basketball * fix missing s on timeFormat * fix linting errors. add line to changelog * Upgrade to Electron 2.0.0. * Update README.md Included /home/pi/MagicMirror/ path when copying config.js.sample and running npm run config:check * Fixes MagicMirrorOrg#1282. Added a runtime var isShowingDescription that gets reset to user config. this.config.showDescription no longer mutates during runtime. Changelog has been updated to include this fix. * fix moment, add unit filter * start with forecast template * Add information about the Electron update. * Add note to README.md Add note to README.md to not add calendars that have entries before 1st January 1970. * add and lint clientonly * Changelog * Ability to fetch compliments from a remote server * Add regex filtering to calendar module * invoke callback for suspend notification, even if no dom content * fix tabs * update changelog * fix changelog * Revert "fix changelog" This reverts commit c3f03e3. * Style change. * remove trailing spaces from reformatted else * Customize classes for table MagicMirror offers helper classes in the main.css. Therefore, we give the possibility to indicate the class that we want. * Update .gitignore * Add changelog * README updated Update of README for the new option. * ESLint format Resolve format ith eslint * Tabs and spaces from the original files With a diff, here the orginal tabulations. * show indoor data, add loading message * minor typo in position fixed. * Add option to newsfeed for logging errors - 'logFeedWarnings' added to newsfeed config, defaulted to false - Only log parse feed errors when logFeedWarnings is true - Updated README and CHANGELOG - Fixes MagicMirrorOrg#1329 * Fix locale id zh_cn -> zh-cn, zh_tw -> zh-tw, pt_br -> pt-br * Update CHANGELOG.md * Add update translations. * Update CHANGELOG.md * Correct the "Raspberry Pi" link in the ToC. * Fixed Heat Index for Kelvin * Fixed Wind Chill in Kelvin * Updated changelog * Updated changelog * Prepare to release 2.4.0 * Setup the next release (2.5.0). * indoor data, new filter, small cleanup * Fixed parsing date, as dt_txt is missing from certain weather API results * Prepare for release 2.4.1 * Prepare for 2.5.0 * Abillity to toggle article in fullscreen * Swedish translation for "FEELS" * Update CHANGELOG.md * Update CHANGELOG.md * Add some translations (mostly french). * Wrong mixup… (cf german and spanish) Thanks fewieden. * CHANGELOG * ADDED: Missing Hungarian localization for the "WEEK" resource key. * ADDED: Missing Hungarian localization for the "FEELS" resource key. * CHANGED: The Hungarian localization of the updatenotification module is changed to be more natural, because the existing messages felt like they were created with machine translation, and they were not only unnatural, but also misleading. * UPDATED: The CHANGELOG.md file with description of the changes in the Hungarian localization. * Added Spanish translation for "FEELS" * Classes for alert module Use of classes instead of inline style. With those modifications, it will be easier to personnalize the alert with custom.css * Changelog.md updated * Update nb.json Added translation for "FEELS" * Update nn.json Added translation for "FEELS" * Added an if to use absolute dates with all events * Added also description of the change to changelog * weatherforecast rainfall rounding * Update CHANGELOG.md * Fix ES6 syntax bug on RaspberryPi Zero W Following this issue MagicMirrorOrg#694 it seems that the Midori Browser does not recoginize ES6 syntax. Further, the use of 'var' is seen throughout the calendar module excpet on line 439, where the error is reported * Add patch note to CHANGELOG.md * Fix link for finding cities in OpenWeather * Update Changelog for weather city link * Update sv.json Small changes. Added "FEELS": "Känns som". * ClientOnly: Global variable name used in callback function. The global 'config' variable is used in the callback function, changed to local one. Unwanted behaviour when accessing server on docker or if using 0.0.0.0 or blank address in config file as it just passes this to electron to display. * Update CHANGELOG.md * consider events lasting several full days as full day events * Correct changelog entry. * added support for events having a duration instead of an end * added support for showing end of events through config parameters showEnd and dateEndFormat * Update CHANGELOG.md * Updating "feels" translation * Polish translate for "Feels" * Update pl.json * CHANGED: The COMMIT_COUNT placeholder in the UPDATE_INFO message of the UpdateNotification module does not contain the word "commit" or "commits" any more, so language files can independently localize them. * ADDED: CHANGELOG entry. * CHANGED: The UPDATE_INFO key in the localization file is changed to UPDATE_INFO_SINGLE and UPDATE_INFO_MULTIPLE to allow different localization for single and multiple commits. * FIXED: Character encoding issue in pl.json occurred during rebase. * CHANGED: The wording in CHANGELOG is modified to be more descriptive. * Add gzip support to calendar fetcher. * update changelog with gzip calendar fix * Merge upstream/develop * update CHANGELOG.md adding gzip fix for calendar module * Update zh-cn translation to 2.5.0 * Update CHANGELOG.md for zh-cn translation updates. * Support multi-line compliments. * Update CHANGELOG.md with multi-line compliments support. * Replace innerHTML() with createElement() and appendChild() for security. * Update compliments README.md for multi-line support. * Use 'white-space: pre-line' for multi-line compliment. * Prepare for release 2.5.0 * Details to install the latest version of Node.js Added the direct code to always install the latest version of Node.js for the manual installation. Maybe you could also include this in the automatic setup script, which does not seem to install the latest version of Node.js. * Prepare for 2.6.0-dev. * Allow to parse recurring calendar events where the start date is before 1970 Some birthday calendar events have a start date before 1970. * Allow to parse recurring calendar events where the start date is before 1970 Some birthday calendar events have a start date before 1970. * Allow to parse recurring calendar events where the start date is before 1900 Some birthday calendar events have a start date before 1900. * - Possibility to add classes to the cell of symbol, title and time of the events of calendar. * Update README.md * Update README.md * * Added font awesome 5, keeping shims in place for the calendar app (https://fontawesome.com/how-to-use/on-the-web/setup/upgrading-from-version-4) * Updated example sample config * Updated changelog * Spaces to tab * Added in 5 day forecast screenshot * Added in screenshot for current weather module. * Added in screenshot * Added in compliments screenshot * Added in screenshot for the newfeed module * (doc) showEnd config Add documentation for showEnd configuration * Update CHANGELOG.md * Fixed README formatting errors. * Fix Broken Link http://www.openweathermap.org/help/city_list.txt is a dead link, suggest replacing with https://openweathermap.org/city * fix polish translation * Change showEnd default to false. * Fixed eslint issues .. as requested in Pull Request MagicMirrorOrg#1424 * Portuguese translation for "Feels" * Ignore rrule errors * Update CHANGELOG.md * Fading for dateheaders Included fading for dateheaders option Removed unnecessary switch statement in dateheaders option * Update CHANGELOG.md - Fading for dateheaders timeFormat in Calendar [MagicMirrorOrg#1464](MagicMirrorOrg#1464) - Bug showing FullDayEvents one day too long in calendar fixe * formatting corrected Corrected formatting due to Travis CI errors * Update README.md Typo * Create hr.json Croatian translation. * Update CHANGELOG.md Added Croatian translation to the changelog. * Update translations.js Added Croatian. * Initial * Add issue number to changelog * CHANGED: The Weather Forecast module by default displays the ° symbol after every numeric value to be consistent with the Current Weather module. * Add ajv dependency to fix linting error. * Document endTime variables Missed docs in MagicMirrorOrg@188aa14 Signed-off-by: David Galloway <dgallowa@redhat.com> * weatherprovider * small improvements * forecast * darksky forecast and darksky current weather fixes * config options and documentation * cleanup * Add changelog entry * add unit and language handling for weather provider darksky * Update ro.json * Update CHANGELOG.md * fixed darksky metric units * fixed beaufortwindspeed for imperial units * add original feels like temperature and fixed it for imperial units * Update README.md Wrong delimiter used for electronOptions. Use : instead of =. * fix rain amount information for different units and providers, documentation * link provider readme in module readme * Prepare for release 2.6.0. * Upgrade Electron to 2.0.16 * Additional update info. * Add dependency.
Please only submit reproducible issues.
Platform: Pi Zero - latest Midori
Node Version: 7.4.0
MagicMirror Version: Latest MM2
Description: Midori is the only browser that reliably and without issues/slowdown can run on the pi zero with MM2. It unfortunately doesnt support ES6 Arrow Functions and causes errors in the pm2 logs and wont load the module. I had this issue with a 3rd party module Profile Switcher and @tosti007 had kindly reverted back to the regular way of using functions and it works perfectly.
Steps to Reproduce: Use Midori to try run the latest compliments, there will be an error in the log and compliments will not start.
Additional Notes: Wondering if there is a way to not use these functions at least until Midori is updated as there are quite a few users of the Pi Zero now.
The text was updated successfully, but these errors were encountered: