Make ts3.3 default for w3c screen orientation (#46960)

* Make ts3.1 the default

* Actually delete ts3.1
This commit is contained in:
Nathan Shively-Sanders 2020-09-01 13:29:23 -07:00 committed by GitHub
parent 78330f7401
commit 7efe08983e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 2 additions and 82 deletions

View File

@ -3,7 +3,6 @@
// Definitions by: Kenneth Rohde Christiansen <https://github.com/kenchris>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
type OrientationType = "portrait-primary" | "portrait-secondary" | "landscape-primary" | "landscape-secondary";
type ScreenOrientationLockType = "any" | "natural" | "landscape" | "portrait" | "portrait-primary" | "portrait-secondary" | "landscape-primary" | "landscape-secondary";
interface ScreenOrientation extends EventTarget {

View File

@ -2,12 +2,7 @@
"private": true,
"types": "index",
"typesVersions": {
">=3.1.0-0": {
"*": [
"ts3.1/*"
]
},
">=3.2.0-0": {
"<=3.2": {
"*": [
"ts3.2/*"
]

View File

@ -1,13 +0,0 @@
type ScreenOrientationLockType = "any" | "natural" | "landscape" | "portrait" | "portrait-primary" | "portrait-secondary" | "landscape-primary" | "landscape-secondary";
interface ScreenOrientation extends EventTarget {
lock(orientation: ScreenOrientationLockType): Promise<void>;
unlock(): void;
readonly type: OrientationType;
readonly angle: number;
addEventListener(type: "change", listener: (this: this, ev: Event) => any, useCapture?: boolean): void;
}
interface Screen {
readonly orientation: ScreenOrientation;
}

View File

@ -1,24 +0,0 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6",
"dom"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": false,
"strictFunctionTypes": true,
"baseUrl": "../../",
"typeRoots": [
"../../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"w3c-screen-orientation-tests.ts"
]
}

View File

@ -1 +0,0 @@
{ "extends": "dtslint/dt.json" }

View File

@ -1,36 +0,0 @@
// Example 1 (from the spec):
const show = () => {
console.log("Orientation type is " + screen.orientation.type);
console.log("Orientation angle is " + screen.orientation.angle);
};
screen.orientation.addEventListener("change", show);
window.onload = show;
// Example 2 (from the spec):
const start = () => {
document.onfullscreenchange = () => {
screen.orientation.lock('natural').then(startInternal);
};
document.documentElement.requestFullscreen();
};
// Example 3 (from the spec):
const startInternal = () => {};
const start2 = () => {
screen.orientation.lock('landscape-primary').then(startInternal, () => {
alert('To start, rotate your screen to landscape.');
const orientationChangeHandler = () => {
if (!screen.orientation.type.startsWith('landscape')) {
return;
}
screen.orientation.removeEventListener('change', orientationChangeHandler);
startInternal();
};
screen.orientation.addEventListener('change', orientationChangeHandler);
});
};
window.onload = start2;

View File

@ -7,7 +7,7 @@
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"strictNullChecks": false,
"strictFunctionTypes": true,
"baseUrl": "../../",
"typeRoots": [