Skip to content

Commit

Permalink
更新
Browse files Browse the repository at this point in the history
  • Loading branch information
yjtx committed Jan 22, 2017
1 parent 106131c commit 23d3d35
Show file tree
Hide file tree
Showing 6 changed files with 249 additions and 260 deletions.
245 changes: 125 additions & 120 deletions libsrc/bin/nest/nest.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,29 +32,6 @@ declare module nest {
loginState?: number;
}
}
interface core {
}
var core: {
/**
* 启动Nest
* @param startupInfo 启动参数
* @param callback 启动完成回调
* @example 以下代码设置appId为 88888,启动Nest
* <pre>
* nest.core.startup({egretAppId:88888}, function (){
* //do something
* });
* </pre>
*/
startup(startupInfo: nest.core.StartupInfo, callback: (resultInfo: nest.core.ResultCallbackInfo) => void): void;
callCustomMethod(customInfo: any, callback: Function): void;
/**
* 添加回调函数
* 渠道有可能有自己的逻辑进行一些操作,这时候会把操作带来的变化回调回来
* @param callback 回调
*/
addCallback(callback: (callbackInfo: nest.core.CallbackInfo) => void): void;
};
/**
* 登录功能逻辑:
* 1.初始化项目数据
Expand All @@ -69,6 +46,7 @@ declare module nest {
* 1.在游戏中放置一个“退出游戏”或者“切换账号”的按钮
* 2.用户点击“退出游戏”图标后,调用 logout 函数
* 3.在登出成功后,返回到登录逻辑的步骤4
* @private
*/
module user {
/**
Expand Down Expand Up @@ -115,6 +93,10 @@ declare module nest {
logout?: number;
}
}
/**
*
* @private
*/
module user {
/**
* 检测是否已登录
Expand Down Expand Up @@ -224,27 +206,6 @@ declare module nest {
ext?: string;
}
}
interface iap {
}
var iap: {
/**
* 支付
* @param payInfo 支付信息
* @param callback 支付回调
* @example 以下代码进行支付
* <pre>
* nest.iap.pay({goodsId:"1",goodsNumber:"1",serverId:"1",ext:"msg"}, function (data){
* if(data.result == 0) {
* //支付成功
* }
* else {
* //支付失败
* }
* });
* </pre>
*/
pay(payInfo: nest.iap.PayInfo, callback: (result: nest.iap.PayCallbackInfo) => void): void;
};
module share {
/**
* 分享接口传递参数
Expand Down Expand Up @@ -277,9 +238,85 @@ declare module nest {
share: number;
}
}
interface share {
module social {
/**
* social接口传递参数
*/
interface SocialSupportCallbackInfo extends core.ResultCallbackInfo {
getFriends?: number;
openBBS?: number;
}
}
module app {
interface AppSupportCallbackInfo extends core.ResultCallbackInfo {
attention?: number;
sendToDesktop?: number;
exitGame?: number;
getInfo?: number;
}
interface GetInfoCallbackInfo extends core.ResultCallbackInfo {
contact: ContactInfo;
}
interface ContactInfo {
qq?: string[];
qqgroup?: string[];
weixin?: string[];
email?: string[];
}
/**
* 发送到桌面
*/
interface SendToDesktopInfo {
/**
* 透传参数
*/
ext: string;
}
}
}
declare module nest {
module core {
/**
* 启动Nest
* @param startupInfo 启动参数
* @param callback 启动完成回调
* @example 以下代码设置appId为 88888,启动Nest
* <pre>
* nest.core.startup({egretAppId:88888}, function (){
* //do something
* });
* </pre>
* @private
*/
function startup(startupInfo: nest.core.StartupInfo, callback: (resultInfo: nest.core.ResultCallbackInfo) => void): void;
function callCustomMethod(customInfo: any, callback: Function): void;
/**
* 添加回调函数
* 渠道有可能有自己的逻辑进行一些操作,这时候会把操作带来的变化回调回来
* @param callback 回调
*/
function addCallback(callback: (callbackInfo: nest.core.CallbackInfo) => void): void;
}
module iap {
/**
* 支付
* @param payInfo 支付信息
* @param callback 支付回调
* @example 以下代码进行支付
* <pre>
* nest.iap.pay({goodsId:"1",goodsNumber:"1",serverId:"1",ext:"msg"}, function (data){
* if(data.result == 0) {
* //支付成功
* }
* else {
* //支付失败
* }
* });
* </pre>
*/
function pay(payInfo: nest.iap.PayInfo, callback: (result: nest.iap.PayCallbackInfo) => void): void;
}
var share: {
module share {
/**
* 是否支持分享
* @param info 请传递一个{}
Expand All @@ -294,14 +331,14 @@ declare module nest {
* });
* </pre>
*/
isSupport(info: Object | shareSupportCallbackType, callback?: shareSupportCallbackType): void;
function isSupport(info: Object | shareSupportCallbackType, callback?: shareSupportCallbackType): void;
/**
* 设置默认分享内容,以便某些渠道在游戏外点击分享按钮时显示分享内容
* @param shareInfo
* @param callback
* @callback-param result 0 表示成功,-2表示失败
*/
setDefaultData(shareInfo: nest.share.ShareInfo, callback: Function): void;
function setDefaultData(shareInfo: nest.share.ShareInfo, callback: Function): void;
/**
* 分享
* @param shareInfo 分享参数
Expand All @@ -320,20 +357,9 @@ declare module nest {
* });
* </pre>
*/
share(shareInfo: share.ShareInfo, callback: (resultInfo: share.ShareCallbackInfo) => void): void;
};
module social {
/**
* social接口传递参数
*/
interface SocialSupportCallbackInfo extends core.ResultCallbackInfo {
getFriends?: number;
openBBS?: number;
}
}
interface social {
function share(shareInfo: share.ShareInfo, callback: (resultInfo: share.ShareCallbackInfo) => void): void;
}
var social: {
module social {
/**
* social接口支持
* @param info 请传递一个{}
Expand All @@ -350,8 +376,8 @@ declare module nest {
* });
* </pre>
*/
isSupport(info: Object | socialSupportCallbackType, callback?: socialSupportCallbackType): void;
getFriends(socialInfo: any, callback: (resultInfo: core.ResultCallbackInfo) => void): void;
function isSupport(info: Object | socialSupportCallbackType, callback?: socialSupportCallbackType): void;
function getFriends(socialInfo: any, callback: (resultInfo: core.ResultCallbackInfo) => void): void;
/**
* 打开BBS
* @param socialInfo 请传递一个{}
Expand All @@ -368,64 +394,36 @@ declare module nest {
* });
* </pre>
*/
openBBS(socialInfo: any, callback: (resultInfo: core.ResultCallbackInfo) => void): void;
};
module app {
interface AppSupportCallbackInfo extends core.ResultCallbackInfo {
attention?: number;
sendToDesktop?: number;
exitGame?: number;
getInfo?: number;
}
interface GetInfoCallbackInfo extends core.ResultCallbackInfo {
contact: ContactInfo;
}
interface ContactInfo {
qq?: string[];
qqgroup?: string[];
weixin?: string[];
email?: string[];
}
/**
* 发送到桌面
*/
interface SendToDesktopInfo {
/**
* 透传参数
*/
ext: string;
}
}
interface app {
function openBBS(socialInfo: any, callback: (resultInfo: core.ResultCallbackInfo) => void): void;
}
var app: {
module app {
/**
* 是否支持特定功能
* @param info 请传递一个{}
* @param callback 回调函数
* @callback-param { result:"0" , attention :"1" , sendToDesktop : "1" , exitGame : "1" , getInfo : "1"}
* attention|sendToDesktop|exitGame|getInfo 1支持 0不支持
*/
isSupport(info: Object | appSupportCallbackType, callback?: appSupportCallbackType): void;
function isSupport(info: Object | appSupportCallbackType, callback?: appSupportCallbackType): void;
/**
* 关注
* @param appInfo
* @param callback
*/
attention(appInfo: any, callback: (resultInfo: core.ResultCallbackInfo) => void): void;
function attention(appInfo: any, callback: (resultInfo: core.ResultCallbackInfo) => void): void;
/**
* 退出游戏,回到 App 界面
* @param appInfo
* @param callback
*/
exitGame(appInfo: any, callback: (resultInfo: core.ResultCallbackInfo) => void): void;
function exitGame(appInfo: any, callback: (resultInfo: core.ResultCallbackInfo) => void): void;
/**
* 发送到桌面
* @param appInfo
* @param callback
* @param callback-param result 0表示添加桌面成功,-1表示添加失败
*/
sendToDesktop(appInfo: app.SendToDesktopInfo, callback: (resultInfo: core.ResultCallbackInfo) => void): void;
function sendToDesktop(appInfo: app.SendToDesktopInfo, callback: (resultInfo: core.ResultCallbackInfo) => void): void;
/**
* 获取渠道信息
* @param appInfo 获取信息参数,没有请传递{}
Expand All @@ -440,8 +438,8 @@ declare module nest {
* "email": //email联系方式数组[],如果没有响应联系方式将没有该字段
* }
*/
getInfo(appInfo: any, callback: (resultInfo: app.GetInfoCallbackInfo) => void): void;
};
function getInfo(appInfo: any, callback: (resultInfo: app.GetInfoCallbackInfo) => void): void;
}
}
declare module nest {
module easyuser {
Expand Down Expand Up @@ -518,9 +516,13 @@ declare module nest {
function logout(loginInfo: nest.user.LoginInfo, callback: (data: nest.core.ResultCallbackInfo) => void): void;
interface UserSupportCallbackInfo extends core.ResultCallbackInfo {
/**
* 是否支持获取用户信息
* 是否支持获取用户信息,值为 1 时支持获取用户信息
*/
getInfo: number;
/**
* 是否支持登出,值为 1 时支持登出
*/
logout?: number;
}
/**
* 检测支持何种登录方式
Expand Down Expand Up @@ -561,26 +563,6 @@ declare module nest {
function getInfo(loginInfo: nest.user.LoginInfo, callback: (resultInfo: Object) => void): void;
}
}
declare module nest.utils {
var $API_DOMAIN: string;
var $APP_ID: number;
var $DEBUG_LOG: boolean;
var $EGRET_SUPPORT: boolean;
function $changeMethod(version: string): void;
var $isRuntime: boolean;
var $spid: number;
function $getSpid(): number;
function $getChannelTag(): string;
function $isQQBrowser(): boolean;
function $isTargetPlatform(target: number): boolean;
function $getOption(key: string): string;
function $log(msg: string): void;
function setProxy(url: string, postData: Object, method: string, callback: Function, errCallback: Function): void;
}
declare module nest.utils.localStorage {
function setItem(key: string, value: string): void;
function getItem(key: string): string;
}
/**
* @private
*/
Expand Down Expand Up @@ -887,3 +869,26 @@ declare module nest.h5_2 {
function getInfo(appInfo: any, callback: Function): void;
}
}
declare module nest.utils {
var $API_DOMAIN: string;
var $APP_ID: number;
var $DEBUG_LOG: boolean;
var $EGRET_SUPPORT: boolean;
function $changeMethod(version: string): void;
var $isRuntime: boolean;
var $spid: number;
function $getSpid(): number;
function $getChannelTag(): string;
function $isQQBrowser(): boolean;
function $isTargetPlatform(target: number): boolean;
function $getOption(key: string): string;
function $log(msg: string): void;
function setProxy(url: string, postData: Object, method: string, callback: Function, errCallback: Function): void;
}
/**
* @private
*/
declare module nest.utils.localStorage {
function setItem(key: string, value: string): void;
function getItem(key: string): string;
}
Loading

0 comments on commit 23d3d35

Please sign in to comment.