import { NetManager } from "../libs/tw/manager/NetManager";


export class NetPromise {
    private static instance: NetPromise;

    public static get ins(): NetPromise {
        if (!this.instance) {
            this.instance = new NetPromise();
        }
        return this.instance;
    }

    constructor() {}

    getPetInfoKuwo(){
        
		let promise = new Promise((resolve,reject)=>{
			NetManager.ins.getPetInfoKuwo((success)=>{
				if(!success){
                    reject('该prormise已被拒绝')
				}
				resolve(success)
			},window["CFG"].activityId)
        })

        return promise.catch(function(error){
            //没错，就是改了这里而已
            throw new Error("失败了:"+error)
        });

    }

    petInteractionKuwo(petId,type){
        let promise =  new Promise((resolve,reject)=>{
            NetManager.ins.petInteractionKuwo((success)=>{
                if(!success){
                    reject('该prormise已被拒绝')
                }
                resolve(success)
            },petId,type,window["signId"])
        })

        return promise.catch(function(error){
            //没错，就是改了这里而已
            throw new Error("失败了:"+error)
        });

    }
}