Skip to content

Commit

Permalink
Fix app and ismobilejs typings (pixijs#8517)
Browse files Browse the repository at this point in the history
  • Loading branch information
bigtimebuddy committed Jul 21, 2022
1 parent 611ca6a commit 6fc416e
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 8 deletions.
5 changes: 3 additions & 2 deletions packages/app/src/ResizePlugin.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import type { CanvasRenderer } from '@pixi/canvas-renderer';
import type { ExtensionMetadata, Renderer } from '@pixi/core';
import { ExtensionType } from '@pixi/core';
import type { IApplicationOptions } from './Application';

type ResizeableRenderer = Pick<Renderer, 'resize'>;

/**
* Middleware for for Application's resize functionality
* @private
Expand All @@ -15,7 +16,7 @@ export class ResizePlugin

public static resizeTo: Window | HTMLElement;
public static resize: () => void;
public static renderer: Renderer | CanvasRenderer;
public static renderer: ResizeableRenderer;
public static queueResize: () => void;
private static _resizeId: number;
private static _resizeTo: Window | HTMLElement;
Expand Down
42 changes: 36 additions & 6 deletions packages/settings/src/utils/isMobile.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,39 @@
// The ESM/CJS versions of ismobilejs only
// exports the function for executing
// designed for Node-only environments
import isMobileCall from 'ismobilejs';
import type { isMobileResult } from 'ismobilejs';

const isMobile: isMobileResult = isMobileCall(globalThis.navigator);
type isMobileResult = {
apple: {
phone: boolean;
ipod: boolean;
tablet: boolean;
universal: boolean;
device: boolean;
};
amazon: {
phone: boolean;
tablet: boolean;
device: boolean;
};
android: {
phone: boolean;
tablet: boolean;
device: boolean;
};
windows: {
phone: boolean;
tablet: boolean;
device: boolean;
};
other: {
blackberry: boolean;
blackberry10: boolean;
opera: boolean;
firefox: boolean;
chrome: boolean;
device: boolean;
};
phone: boolean;
tablet: boolean;
any: boolean;
};

export { isMobile };
export const isMobile: isMobileResult = isMobileCall(globalThis.navigator);

0 comments on commit 6fc416e

Please sign in to comment.