-
-
Notifications
You must be signed in to change notification settings - Fork 4.9k
feat: use DomAdapter for new Image #11565
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
Conversation
Fixes: #11545 Ensures image creation uses the environment adapter. This change standardizes image creation across different environments (browser, web worker, node) by using the adapter pattern
This pull request is automatically built and testable in CodeSandbox. To see build info of the built libraries, click here or the icon next to each commit SHA. Latest deployment of this branch, based on commit bb039f1:
|
/**
* Interface for HTMLImageElement.
* @category environment
* @advanced
*/
export interface IImage extends EventTarget
{
/** Whether or not the image has completely loaded. */
readonly complete: boolean;
/** The Cross-Origin Resource Sharing (CORS) setting to use when retrieving the image. */
crossOrigin: string | null;
/** The URL of the image which is currently presented in the <img> element it represents. */
readonly currentSrc: string;
/** The width. */
width: number;
/** The height. */
height: number;
/** The address or URL of the a media resource that is to be considered. */
src: string;
/** Returns a Promise that resolves once the image is decoded. */
decode(): Promise<void>;
onload: ((this: GlobalEventHandlers, ev: Event) => any) | null;
onerror: ((this: GlobalEventHandlers, ev: Event) => any) | null;
} |
pixi.js-base • pixi.js-bunny-mark
commit: |
@UlyssesZh Thanks for providing the |
I think some types also needs to be changed from |
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.
Very helpful. The double-I bothers me, but I don't have anything better to offer for names.
One thing that might be worth considering in a follow up is disallowing except in DOMAdpater things like document.createElement
or new Image
with some lint rules. This is an easy thing to regress and we don't have a good tests it.
I also don't like the double-I
|
|
Updates the image interface to a more generic `ImageLike`
I like |
Yeah, good call on CanvasLike |
Fixes: #11545
Ensures image creation uses the environment adapter. This change standardizes image creation across different environments (browser, web worker, node) by using the adapter pattern