Skip to content

Commit

Permalink
fix: bonjour conditional loading (betaflight#3687)
Browse files Browse the repository at this point in the history
  • Loading branch information
chmelevskij committed Apr 27, 2024
1 parent e59a980 commit 255dd6f
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 14 deletions.
2 changes: 1 addition & 1 deletion src/css/tabs/gps.less
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@import '/node_modules/ol/ol.css';
@import 'ol/ol.css';

#map {
height: 100%;
Expand Down
26 changes: 13 additions & 13 deletions src/js/mdns_discovery.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import GUI from './gui';
import PortHandler from './port_handler';
import { isWeb } from './utils/isWeb';

const MDNS_INTERVAL = 10000;
const TCP_CHECK_INTERVAL = 5000;
Expand Down Expand Up @@ -49,20 +50,19 @@ MdnsDiscovery.initialize = function() {

reinit();
} else {
if(typeof require === 'undefined') {
return 'not implemented';
}
const bonjour = require('bonjour')();

self.mdnsBrowser.browser = bonjour.find({ type: 'http' }, service => {
console.log("Found HTTP service", service);
self.mdnsBrowser.services.push({
addresses: service.addresses,
txt: service.txt,
fqdn: service.fqdn,
ready: true,
if(!isWeb()) {
import('bonjour').then(({ default: bonjour }) => {
self.mdnsBrowser.browser = bonjour.find({ type: 'http' }, service => {
console.log("Found HTTP service", service);
self.mdnsBrowser.services.push({
addresses: service.addresses,
txt: service.txt,
fqdn: service.fqdn,
ready: true,
});
});
});
});
}
}

setInterval(() => {
Expand Down

0 comments on commit 255dd6f

Please sign in to comment.