@byted-creative/stt-promisify

将 tt 的异步接口封装成 promise 版本

Usage no npm install needed!

<script type="module">
  import bytedCreativeSttPromisify from 'https://cdn.skypack.dev/@byted-creative/stt-promisify';
</script>

README

User Guide

@byted-dino/tt-promisify

简介

将 tt 的异步接口封装成 promise 版本

使用说明

浏览器下的支持使用 tmg-h5-sdk 实现

安装

npm安装

npm install @byted-dino/tt-promisify

yarn安装

yarn add @byted-dino/tt-promisify

使用方法

小游戏

import stt from "@byted-dino/tt-promisify";

try {
    const res = await stt.showToast({
        title: "hello",
        icon: "none",
        duration: 6000
    });
} catch(err) {
    console.log(err);
}
 
stt.showToast({
    title: "hello",
    icon: "none",
    duration: 6000
}).then(res => {
    console.log(res);
}).catch(err => {
    console.log(err);
})

小程序


try {
    const res = await stt.getMenuButtonBoundingClientRect({});
    console.log(res);
} catch(err) {
    console.log(err);
}

stt.getMenuButtonBoundingClientRect({}).then(res => {
    console.log(res);
}).catch(err => {
    console.log(err);
})