pcom-isv-base
Version:
千叶ISV基础能力
56 lines (51 loc) • 2 kB
TypeScript
export interface ScreenRule {
capture?: boolean;
onScroll?: boolean;
}
export interface CaptureResult {
errorCode: string;
errorMessage: string;
status: string;
url: string;
localPath: string;
}
export default function generate(rules?: ScreenRule[]): {
capture: (type?: "view" | "app", inAlbum?: boolean) => Promise<any>;
/** JS 执行是无效的
stopRefresh: () => {
if (!screenRules.stopRefresh) {
return Promise.reject(new Error(`[Screen]:不允许使用 stopRefresh `))
}
Windvane.call2('AliCommon.setPullRefreshEnabled', { 'enabled': false }).then((result) => {
alert('L38' + JSON.stringify(result, null, 2))
}).catch((e) => {
alert('L40' + JSON.stringify(e, null, 2))
})
Windvane.call2('ALICommon.setPullRefreshEnabled', { 'enabled': false }).then((result) => {
alert('L43' + JSON.stringify(result, null, 2))
}).catch((e) => {
alert('L45' + JSON.stringify(e, null, 2))
})
// stopRefresh()
// from http://gitlab.alibaba-inc.com/mui/mu/blob/master/src/packages/lib/jsBridge/stopRefresh.js
// 阻止下拉刷新 old
let head = document.head
let StopRefresh = document.createElement('meta')
StopRefresh.setAttribute('id', 'stopUsePullRefresh')
StopRefresh.setAttribute('value', 'true')
head.appendChild(StopRefresh)
// 去除橡皮筋效果
let StopBounces = document.createElement('meta')
StopBounces.setAttribute('id', 'WV.Meta.StopBounces')
StopBounces.setAttribute('value', 'true')
head.appendChild(StopBounces)
// 手淘 iOS 5.4.4 Android 5.4.12 或更高版本
let StopRefreshNew = document.createElement('meta')
StopRefreshNew.setAttribute('id', 'WV.Meta.DisableRefresh')
StopRefreshNew.setAttribute('value', 'true')
head.appendChild(StopRefreshNew)
},*/
onScroll: (cb?: (options: {
scrollTop: number;
}) => void) => void;
};