Frontmatter
| id | 5758 |
| title | Remove main.addon.Browser |
| state | Closed |
| labels | enhancement |
| assignees | [] |
| createdAt | Aug 15, 2024, 12:41 AM |
| updatedAt | Aug 15, 2024, 2:05 AM |
| githubUrl | https://github.com/neomjs/neo/issues/5758 |
| author | tobiu |
| commentsCount | 1 |
| parentIssue | null |
| subIssues | [] |
| subIssuesCompleted | 0 |
| subIssuesTotal | 0 |
| blockedBy | [] |
| blocking | [] |
| closedAt | Aug 15, 2024, 2:05 AM |
Remove main.addon.Browser

rwaters
Aug 15, 2024, 12:47 AM
Agreed that feature detection & media queries over browser detection are the way to go. Provides much more future proof code that does not need to be continually maintained as browsers evolve.
rwaters closed this issue on Aug 15, 2024, 12:47 AM
rwaters reopened this issue on Aug 15, 2024, 12:47 AM
tobiu closed this issue on Aug 15, 2024, 2:05 AM
@Dinkh @rwaters: https://github.com/neomjs/neo/blob/dev/src/main/addon/Browser.mjs We should really stick to feature detection and not use regex to try determine a device type, which is not needed. The regex contains very outdated device types, but this is not the point.
Counter example:
// worker.Manager detectFeatures() { let me = this; NeoConfig.hasMouseEvents = matchMedia('(pointer:fine)').matches; NeoConfig.hasTouchEvents = ('ontouchstart' in window) || (navigator.maxTouchPoints > 0); if (window.Worker) { me.webWorkersEnabled = true } else { throw new Error('Your browser does not support Web Workers') } if (window.SharedWorker) { me.sharedWorkersEnabled = true } } // main.addon.DragDrop if (Neo.config.hasMouseEvents) { imports.push(import('../draggable/sensor/Mouse.mjs')) } if (Neo.config.hasTouchEvents) { imports.push(import('../draggable/sensor/Touch.mjs')) }What could be important for styling (like the ContentBoxes inside the Portal App) is the info, if there is a mouse or not. So adding a new CSS rule to the doc body like
neo-no-mouseshould be fine.For styling, only the sizes matter (responsive breakpoints).
If you want to get the user agent info for a specific use case, you can already easily do it:
Neo.Main.getByPath({path: 'navigator.userAgent'}).then(userAgent => {});