0.0.3 • Published 3 years ago

@warpsoft/screen-orientation v0.0.3

Weekly downloads
-
License
MIT
Repository
-
Last release
3 years ago

@warpsoft/screen-orientation

控制手机屏幕方向的插件

Install

npm install @warpsoft/screen-orientation
npx cap sync

iOS

For iOS, you must make the following adjustments to your AppDelegate.swift file:

import UIKit
...snip...
+ import WarpsoftScreenOrientation

@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
    ...snip...
+   func application(_ application: UIApplication, supportedInterfaceOrientationsFor window: UIWindow?) -> UIInterfaceOrientationMask {
+     return ScreenOrientationPlugin.supportedOrientations
+  }
    ...snip...
}

API

orientation()

orientation() => Promise<{ type: OrientationMode; }>

获取屏幕当前的方向

Returns: Promise<{ type: OrientationMode; }>


lock(...)

lock(options: LockOptions) => Promise<void>

使得屏幕旋转到某个方向上并锁定

ParamTypeDescription
optionsLockOptions选项参数

unlock()

unlock() => Promise<void>

解锁屏幕方向的锁定


Interfaces

LockOptions

旋转并锁定屏幕方向的参数

PropTypeDescription
typeOrientationMode方向

Enums

OrientationMode

MembersValueDescription
PORTRAIT_PRIMARY'portrait-primary'纵向-正面
PORTRAIT_SECONDARY'portrait-secondary'纵向-反面
LANDSCAPE_PRIMARY'landscape-primary'横向-正面
LANDSCAPE_SECONDARY'landscape-secondary'横向-反面
0.0.3

3 years ago

0.0.2

4 years ago

0.0.1

4 years ago