提交 563916cf 编写于 作者: fxy060608's avatar fxy060608

chore: add tests

上级 703fbd1b
{"version":3,"sources":["uni_modules/uts-getbatteryinfo/utssdk/app-ios/index.uts"],"sourcesContent":["// 引用 iOS 原生平台 api\nimport { UIDevice } from \"UIKit\";\nimport { Int } from 'Swift';\n\n/**\n * 定义 接口参数\n */\ntype GetBatteryInfoOptions = {\n success?: (res: object) => void;\n fail?: (res: object) => void;\n complete?: (res: object) => void;\n};\n\n/**\n * 导出 获取电量方法 \n */\nexport default function getBatteryInfo(options: GetBatteryInfoOptions) {\n\t\n\t// 开启电量检测\n\tUIDevice.current.isBatteryMonitoringEnabled = true\n\t\n\t// 返回数据\n const res = {\n errMsg: \"getBatteryInfo:ok\",\n level: new Int(UIDevice.current.batteryLevel * 100),\n isCharging: UIDevice.current.batteryState == UIDevice.BatteryState.charging,\n };\n options.success?.(res);\n options.complete?.(res);\n}\n"],"names":[],"mappings":";AACA;AACA;AAK6B;;MAAxB;IACD,WAAA,SAAQ,aAAwB;IAChC,WAAA,MAAK,aAAwB;IAC7B,WAAA,UAAS,aAAwB;AACrC;AAKe,KAAS,eAAe,EAAA,SAAS,qBAAqB,EAAE;IAGtE,SAAS,OAAO,CAAC,0BAA0B,GAAG,IAAI;IAG/C,IAAM,MAAM;QACR,CAAA,SAAQ;QACR,CAAA,QAAO,AAAI,IAAI,SAAS,OAAO,CAAC,YAAY,GAAG,GAAG;QAClD,CAAA,aAAY,SAAS,OAAO,CAAC,YAAY,IAAI,SAAS,YAAY,CAAC,QAAQ;MAC9E;IACD,QAAQ,OAAO,EAAG;IAClB,QAAQ,QAAQ,EAAG;AACvB;;;;wCAbuC,EAAA,SAAS,qBAAqB;eAA7C,eAAe"}
\ No newline at end of file
import { readFileSync } from 'fs'
import { join } from 'path'
import { SourceMapConsumer } from 'source-map'
async function run() {
const consumer = await new SourceMapConsumer(
readFileSync(join(__dirname, './examples/sourcemap/demo.swift.map'), 'utf8')
)
console.log(
consumer.originalPositionFor({
line: 1,
column: 8,
})
)
console.log(
consumer.generatedPositionFor({
source: 'uni_modules/uts-getbatteryinfo/utssdk/app-ios/index.uts',
line: 1,
column: 8,
})
)
}
run()
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册