1export function mockFeatureAbility() { 2 let FeatureAbilityObject = { 3 getFeatureAbility: function () { 4 const ResultMock = { 5 code: '[PC preview] unknow code', 6 data: '[PC preview] unknow data' 7 } 8 const FeatureAbility = { 9 startAbility: function (...args) { 10 console.warn("Unable to use the FeatureAbility.startAbility method to start another ability in the" + 11 " Previewer. Perform this operation on the emulator or a real device instead.") 12 return new Promise((resolve, reject) => { 13 resolve(ResultMock); 14 }) 15 }, 16 startAbilityForResult: function (...args) { 17 console.warn("Unable to use the FeatureAbility.startAbilityForResult method to start another ability in" + 18 " the Previewer. Perform this operation on the emulator or a real device instead.") 19 return new Promise((resolve, reject) => { 20 resolve(ResultMock); 21 }) 22 }, 23 finishWithResult: function (...args) { 24 console.warn("FeatureAbility.finishWithResult interface mocked in the Previewer. How this interface works" + 25 " on the Previewer may be different from that on a real device.") 26 return new Promise((resolve, reject) => { 27 resolve(ResultMock); 28 }) 29 }, 30 callAbility: function (...args) { 31 console.warn("FeatureAbility.callAbility interface mocked in the Previewer. How this interface works on" + 32 " the Previewer may be different from that on a real device.") 33 return new Promise((resolve, reject) => { 34 resolve(JSON.stringify(ResultMock)); 35 }) 36 }, 37 continueAbility: function (...args) { 38 console.warn("FeatureAbility.continueAbility interface mocked in the Previewer. How this interface works on" + 39 " the Previewer may be different from that on a real device.") 40 return new Promise((resolve, reject) => { 41 resolve(ResultMock); 42 }) 43 }, 44 subscribeAbilityEvent: function (...args) { 45 console.warn("FeatureAbility.subscribeAbilityEvent interface mocked in the Previewer. How this interface" + 46 " works on the Previewer may be different from that on a real device.") 47 return new Promise((resolve, reject) => { 48 resolve(JSON.stringify(ResultMock)); 49 }) 50 }, 51 unsubscribeAbilityEvent: function (...args) { 52 console.warn("FeatureAbility.unsubscribeAbilityEvent interface mocked in the Previewer. How this interface" + 53 " works on the Previewer may be different from that on a real device.") 54 return new Promise((resolve, reject) => { 55 resolve(JSON.stringify(ResultMock)); 56 }) 57 } 58 } 59 return FeatureAbility 60 } 61 } 62 global.createLocalParticleAbility = function (...args) { 63 console.warn("createLocalParticleAbility interface mocked in the Previewer. How this interface" + 64 " works on the Previewer may be different from that on a real device.") 65 return new Promise((resolve, reject) => { 66 resolve(paramMock.paramObjectMock); 67 }) 68 } 69 global.FeatureAbility = FeatureAbilityObject.getFeatureAbility(); 70}