WebApp快捷打包
飞鸟广告
转到模块插件

敬告:此 DEMO 演示为开放测试页面,仅用于开发者快速测试体验应用功能,请严格遵守开发者协议,了解更多

JS-SDK 引用方式:

♦ 普通网页 script 方式加载:下载最新版 jsBridge-v20240326.zip,请在页面上调用 jsBridge 接口之前引用 jsbridge-mini.js 库;

♦ js module 方式引用:npm install ym-jsbridge 具体请参考 npm package

setListener 设置监听器

• 如需接口调用事件,请设置此监听器;

jsBridge.topflow.setListener(function(event, data) {
  show({
    event: event,
    data : data
  });
});

//请拉到页面底部查看回调数据信息
$('html,body').animate({ scrollTop: $('#view').offset().top }, 500);

/**
回调参数说明:
event - 事件代码,字符串类型
data  - 事件数据,JSON 对象

错误码请参考
1. https://developers.adnet.qq.com/doc/android/union/union_debug#sdk%20%E9%94%99%E8%AF%AF%E7%A0%81
2. https://developers.adnet.qq.com/backend/error_code.html
**/

removeListener 移除监听器

//移除监听器,不会再收到回调通知
//在需要时可重新调用 setListener
jsBridge.topflow.removeListener();

展示广告

rewardVideo 激励视频广告

//激励视频广告
jsBridge.topflow.rewardVideo({
  //必须,字符串类型,奖励单位
  unit: "金币",
  //必须,字符串类型,用户ID
  user: "13800138000"
}, function(succ, data) {
  if (!succ) {
    alert(JSON.stringify(data));
  }
});

banner 原生横幅广告 - 展示

//原生横幅广告 - 展示
jsBridge.topflow.banner({
  //必须,数字类型,广告位置上边距
  top  : 0,
  //必须,数字类型,宽度
  width: 640
}, function(succ, data) {
  if (!succ) {
    alert(JSON.stringify(data));
  }
});

banner 原生横幅广告 - 移除

//原生横幅广告 - 移除
jsBridge.topflow.banner({
  remove: true
}, function(succ, data) {
  if (!succ) {
    alert(JSON.stringify(data));
  }
});

监听回调数据: