1.0.1 • Published 4 years ago
@ycsdk/runtime v1.0.1
#runtime
本api为多平台部分接口的封装,使用时,无需关注小游戏平台,而只需要关注本api的封装即可。
部分api 不同平台支持不同,以具体平台为主。不支持的参数,在不支持的平台使用时,可能会抛出警告 平台不支持的api,本api封装时,会抛出异常,在使用时,需要考虑兼容性
使用
通过 npm
安装 @ycsdk/runtime
包,然后导入即可使用 runtime
import runtime from "@ycsdk/runtime";
api的具体参数及返回值说明,可以在 @ycsdk/runtime
包下的index.d.ts文件查看
发起 HTTPS 网络请求
runtime.request(options: RequestOptions): RequestTask;
创建banner广告
runtime.createBannerAd(options: BannerAdOptions): BannerAd;
创建激励视频广告
runtime.createRewardedVideoAd(options: RewardedVideoAdOptions): RewardedVideoAd;
获取系统信息
runtime.getSystemInfoSync(): SystemInfo;
创建插屏广告
runtime.createInterstitialAd(options: InterstitialAdOptions): InterstitialAd;
小程序/小游戏跳转
runtime.navigateToMiniProgram(options: NavigateToMiniProgramOptions);
登陆接口
runtime.login(options: LoginOptions);
获取启动参数
runtime.getLaunchOptionsSync(): LaunchOptions;