-
-
Notifications
You must be signed in to change notification settings - Fork 745
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
Combine ResourceType
interface and const into a single enum
#2103
Conversation
Move it from ajax.ts to request_manager.ts
@HarelM ready for review. |
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.
The only comment I have is string vs enum. If we can keep it as string I would prefer it instead of breaking this very much used API. I know it's version 3 and we can break, but if possible, I would like to avoid breaking the transform function.
Strongly disagree with adding the |
I don't have hard feelings regarding the prefix. I can live with it and without it. |
It's just unnecessary code churn. Unless there's another |
Once again, that's done for the sakes of consistency with other custom types (this will be implemented with further PRs). Namely, there's a built-in type called |
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.
LGTM, @drwestco any other comments?
It's a slippery slope, and an unnecessary rename in this case. Even if you are forced to rename the existing Take a look at the exported (and publicly documented, sorta) function signature:
Is this also going to become |
@drwestco I thought about it all and both are actually good points. Let's not use Regarding the @HarelM Please, re-check. |
Wow, this makes this PR super simple. |
* Remove unused tile request cache (maplibre#2101) * Remove unused tile request cache * Remove the public method to clear the storage * Get rid of tile request cache's usages * merge 2101 * Combine `ResourceType` interface and const into a single enum (maplibre#2103) * Combine ResourceType interface and const into a single enum Move it from ajax.ts to request_manager.ts * Re-run render tests * Assign strting values to the enum * Revert changes to tests * Fix typo * Don't use MapLibre prefix; use const enum * Fix "npm run test-build" on Windows (maplibre#2106) * wip * fixed path * rename var * remove timeout * add type and use namespace * test passed * refactored and cleaned * min test * all working * restore min test --------- Co-authored-by: Matthew Mamonov <g.smellyshovel@gmail.com>
* Remove unused tile request cache (maplibre#2101) * Remove unused tile request cache * Remove the public method to clear the storage * Get rid of tile request cache's usages * merge 2101 * Combine `ResourceType` interface and const into a single enum (maplibre#2103) * Combine ResourceType interface and const into a single enum Move it from ajax.ts to request_manager.ts * Re-run render tests * Assign strting values to the enum * Revert changes to tests * Fix typo * Don't use MapLibre prefix; use const enum * Fix "npm run test-build" on Windows (maplibre#2106) * wip * fixed path * rename var * remove timeout * add type and use namespace * test passed * refactored and cleaned * min test * all working * restore min test * clean up the cancel function --------- Co-authored-by: Matthew Mamonov <g.smellyshovel@gmail.com>
…erformance (#2097) * Throttle the image request queue while the map is moving to improve performance The image request queue can cause frame rate glitches while the map is moving. To mitigate this, allow the map renderer to throttle the amount of requests processed by the image request queue until the map stops moving again. * Add AJAX unit test. * Fix cancelRequest function * lint fixes * Fix typo in comment. * Make amount of throttling be configurable. * Rename MAX_PARALLEL_IMAGE_REQUESTS_WHILE_THROTTLED to MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME_WHILE_THROTTLED * Add getter/setter maxParallelImageRequestsPerFrameWhileThrottled() * Fix lint issue. * Fix math error when computing maxImageRequests. * Add changelog entry * Move image request queue functions out of ajax.ts and into new image_request_queue.ts. * Move image request queue code back into ajax.ts to minimize diffs. * Reorganize image request queue code into a class (ImageRequestQueue). * Add jsdoc comments * Modify ImageRequestQueue class to call itself directly rather than via the pure function wrappers. * Remove one instance of `theQueue` syntax that wasn't necessary. * Fix unit test failure. * Update changelog with PR 2097 * merge 2101 * PR updates (#3) * Remove unused tile request cache (#2101) * Remove unused tile request cache * Remove the public method to clear the storage * Get rid of tile request cache's usages * merge 2101 * Combine `ResourceType` interface and const into a single enum (#2103) * Combine ResourceType interface and const into a single enum Move it from ajax.ts to request_manager.ts * Re-run render tests * Assign strting values to the enum * Revert changes to tests * Fix typo * Don't use MapLibre prefix; use const enum * Fix "npm run test-build" on Windows (#2106) * wip * fixed path * rename var * remove timeout * add type and use namespace * test passed * refactored and cleaned * min test * all working * restore min test * clean up the cancel function --------- Co-authored-by: Matthew Mamonov <g.smellyshovel@gmail.com> * lint * update to 754099 * PR feedback * doc --------- Co-authored-by: Adam Szofran <adam.szofran@microsoft.com> Co-authored-by: Matthew Mamonov <g.smellyshovel@gmail.com>
Part 2 of series of refactoring PRs (splitted up #2038).
Combines interface and const
ResourceType
into a singleconst enum
enity calledResourceType
and moves it fromajax.ts
torequest_manager.ts
.Reasons:
enum
intointerface
andconst
and then to create an artificial type from thisinterface
ajax.ts
is not responsible for resource types nor they are used in there.request_manager.ts
is using them and thus should be responsible for its definition