Skip to content

ECS Framework API v2.1.50


ECS Framework API / IPlatformAdapter

Interface: IPlatformAdapter

Defined in: Platform/IPlatformAdapter.ts:5

平台适配器接口 用于适配不同的运行环境(浏览器、微信小游戏、字节跳动小游戏等)

Properties

name

readonly name: string

Defined in: Platform/IPlatformAdapter.ts:9

平台名称


version?

readonly optional version: string

Defined in: Platform/IPlatformAdapter.ts:14

平台版本信息

Methods

isWorkerSupported()

isWorkerSupported(): boolean

Defined in: Platform/IPlatformAdapter.ts:19

检查是否支持Worker

Returns

boolean


isSharedArrayBufferSupported()

isSharedArrayBufferSupported(): boolean

Defined in: Platform/IPlatformAdapter.ts:24

检查是否支持SharedArrayBuffer

Returns

boolean


getHardwareConcurrency()

getHardwareConcurrency(): number

Defined in: Platform/IPlatformAdapter.ts:29

获取硬件并发数(CPU核心数)

Returns

number


createWorker()

createWorker(script, options?): PlatformWorker

Defined in: Platform/IPlatformAdapter.ts:36

创建Worker

Parameters

script

string

Worker脚本内容

options?

WorkerCreationOptions

Worker选项

Returns

PlatformWorker


createSharedArrayBuffer()

createSharedArrayBuffer(length): null | SharedArrayBuffer

Defined in: Platform/IPlatformAdapter.ts:42

创建SharedArrayBuffer

Parameters

length

number

缓冲区大小(字节)

Returns

null | SharedArrayBuffer


getHighResTimestamp()

getHighResTimestamp(): number

Defined in: Platform/IPlatformAdapter.ts:47

获取高精度时间戳

Returns

number


getPlatformConfig()

getPlatformConfig(): PlatformConfig

Defined in: Platform/IPlatformAdapter.ts:52

获取平台特定的配置

Returns

PlatformConfig


getPlatformConfigAsync()?

optional getPlatformConfigAsync(): Promise<PlatformConfig>

Defined in: Platform/IPlatformAdapter.ts:57

异步获取平台配置(包含需要异步获取的信息)

Returns

Promise<PlatformConfig>

Released under the MIT License.