mirror of
https://github.com/openharmony/third_party_jsframework.git
synced 2026-08-26 21:11:18 -04:00
8b22f4f9fe
Signed-off-by: zhongjianfei <zhongjianfei@huawei.com> Change-Id: I2f4b3d48538c7e3d8172461fcb3b50f3299e339a
70 lines
3.3 KiB
JavaScript
70 lines
3.3 KiB
JavaScript
export function mockFeatureAbility() {
|
|
let FeatureAbilityObject = {
|
|
getFeatureAbility: function () {
|
|
const ResultMock = {
|
|
code: '[PC preview] unknow code',
|
|
data: '[PC preview] unknow data'
|
|
}
|
|
const FeatureAbility = {
|
|
startAbility: function (...args) {
|
|
console.warn("Unable to use the FeatureAbility.startAbility method to start another ability in the" +
|
|
" Previewer. Perform this operation on the emulator or a real device instead.")
|
|
return new Promise((resolve, reject) => {
|
|
resolve(ResultMock);
|
|
})
|
|
},
|
|
startAbilityForResult: function (...args) {
|
|
console.warn("Unable to use the FeatureAbility.startAbilityForResult method to start another ability in" +
|
|
" the Previewer. Perform this operation on the emulator or a real device instead.")
|
|
return new Promise((resolve, reject) => {
|
|
resolve(ResultMock);
|
|
})
|
|
},
|
|
finishWithResult: function (...args) {
|
|
console.warn("FeatureAbility.finishWithResult interface mocked in the Previewer. How this interface works" +
|
|
" on the Previewer may be different from that on a real device.")
|
|
return new Promise((resolve, reject) => {
|
|
resolve(ResultMock);
|
|
})
|
|
},
|
|
callAbility: function (...args) {
|
|
console.warn("FeatureAbility.callAbility interface mocked in the Previewer. How this interface works on" +
|
|
" the Previewer may be different from that on a real device.")
|
|
return new Promise((resolve, reject) => {
|
|
resolve(JSON.stringify(ResultMock));
|
|
})
|
|
},
|
|
continueAbility: function (...args) {
|
|
console.warn("FeatureAbility.continueAbility interface mocked in the Previewer. How this interface works on" +
|
|
" the Previewer may be different from that on a real device.")
|
|
return new Promise((resolve, reject) => {
|
|
resolve(ResultMock);
|
|
})
|
|
},
|
|
subscribeAbilityEvent: function (...args) {
|
|
console.warn("FeatureAbility.subscribeAbilityEvent interface mocked in the Previewer. How this interface" +
|
|
" works on the Previewer may be different from that on a real device.")
|
|
return new Promise((resolve, reject) => {
|
|
resolve(JSON.stringify(ResultMock));
|
|
})
|
|
},
|
|
unsubscribeAbilityEvent: function (...args) {
|
|
console.warn("FeatureAbility.unsubscribeAbilityEvent interface mocked in the Previewer. How this interface" +
|
|
" works on the Previewer may be different from that on a real device.")
|
|
return new Promise((resolve, reject) => {
|
|
resolve(JSON.stringify(ResultMock));
|
|
})
|
|
}
|
|
}
|
|
return FeatureAbility
|
|
}
|
|
}
|
|
global.createLocalParticleAbility = function (...args) {
|
|
console.warn("createLocalParticleAbility interface mocked in the Previewer. How this interface" +
|
|
" works on the Previewer may be different from that on a real device.")
|
|
return new Promise((resolve, reject) => {
|
|
resolve(paramMock.paramObjectMock);
|
|
})
|
|
}
|
|
global.FeatureAbility = FeatureAbilityObject.getFeatureAbility();
|
|
} |