import Urbit from "@urbit/http-api"; const api = new Urbit('', '', window.desk); api.ship = window.ship; // @urbit/http-api 2.x adds `window.addEventListener('beforeunload', this.delete)` // unbound, so its beacon is sent to `${location dir}/undefined` (404) and the // channel is left open until eyre's 12h timeout. Replace it with a bound one. window.removeEventListener('beforeunload', api.delete); window.addEventListener('beforeunload', () => api.delete()); export default api;