-
-
Notifications
You must be signed in to change notification settings - Fork 715
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
Typescript: TMP WIP further fixes including window and point.ts (rebase on typescript gl matrix) #224
Typescript: TMP WIP further fixes including window and point.ts (rebase on typescript gl matrix) #224
Conversation
I'll review each commit separately and let you know which commit I think should be picked to a separate PR so it can be merged. |
Let's create a PR with this commit after the changes: |
load: 'load', | ||
fullLoad: 'fullLoad' | ||
}; | ||
export enum PerformanceMarkers { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's a much better solution than I had... Cool
@@ -151,7 +150,7 @@ class ScrollZoomHandler { | |||
if (!this.isEnabled()) return; | |||
|
|||
// Remove `any` cast when https://github.com/facebook/flow/issues/4879 is fixed. | |||
let value = e.deltaMode === (window.WheelEvent as any).DOM_DELTA_LINE ? e.deltaY * 40 : e.deltaY; | |||
let value = e.deltaMode === (WheelEvent as any).DOM_DELTA_LINE ? e.deltaY * 40 : e.deltaY; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think there's no need for as any
here as typescript is supporting this? also the comment above is probably not needed too...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
removed in new PR
import mapboxgl from '../../'; | ||
|
||
import type {WorkerInterface} from '../web_worker'; | ||
|
||
export default function(): WorkerInterface { | ||
return new window.Worker(mapboxgl.workerUrl) as any; | ||
return new Worker(mapboxgl.workerUrl) as any; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we change this to maplibregl
(rename of the import veriable)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sure, didn't notice.. I will keep an eye out for Mapbox references in future. I think I've seen a few and wondered why they were there but assumed compatibility with existing data sources or something. Maybe a project wide search to find all and document which ones we want to keep and why so we don't keep running into this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tried to did a full search, I fixed most of it, but didn't want to change things related to workers.
But don't invest time in this right now, we'll do it later on when everything starts working again...
@@ -120,7 +120,7 @@ export function cacheGet(request: Request, callback: (error?: any | null, respon | |||
|
|||
function isFresh(response) { | |||
if (!response) return false; | |||
const expires = new Date(response.headers.get('Expires') || 0); | |||
const expires = new Date(response.headers.get('Expires') || 0).valueOf(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't this be getTime()
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To be honest I've never used get time but I don't know that there are cases where they might behave differently. I think you're right, something from the SO post makes me believe that getTime()
would always return the same while maybe different browsers could have some different internal representation? I'm fine to update to getTime.. will make the change in the cherry-picked PR
OK, I reviewed the commits. |
I know we don't want to merge gl-matrix yet but to avoid re-fixing the same issues (or just looking at the noise rather than actual unsolved stuff) I worked on top of the unmerged branch, with the aim to cherry pick, so thanks for the review, I'll get those broken out into PRs. |
this is no longer useful, closing |
Just sharing progress, individual groups of fixes can be cherry picked out of this into PRs
down to 202 errors (from 258.. - 56 errors)
rebased on gl-matrix which we are not 100% confident to merge yet
uses point.ts with local imports and types instead of point-geometry library
remove references to window where appropriate (window is imported so it can be overridden for testing, be careful we can still test all we need to)
apply changelog label ('bug', 'feature', 'docs', etc) or use the label 'skip changelog'
add an entry inside this element for inclusion in the
maplibre-gl-js
changelog:<changelog></changelog>