npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

luksdk-web

v1.1.13

Published

1. 补充收到其他来源的postMessage时的异常处理 ### 1.1.12 1. 增加平台音频播放接口onGameMusicStopPlay, onGameMusicStopPlay, onGameEffectSoundStartPlay, onGameEffectSoundStopPlay ### 1.1.11 1. setUserInfo接口增加两个bool参数,传true的情况下可在登录的同时直接获取游戏列表 ### 1.1.10 1. 增加openPlatformPage接口

Readme

更新内容

1.1.13

  1. 补充收到其他来源的postMessage时的异常处理

1.1.12

  1. 增加平台音频播放接口onGameMusicStopPlay, onGameMusicStopPlay, onGameEffectSoundStartPlay, onGameEffectSoundStopPlay

1.1.11

  1. setUserInfo接口增加两个bool参数,传true的情况下可在登录的同时直接获取游戏列表

1.1.10

  1. 增加openPlatformPage接口

1.1.9

  1. 去除调用接口时的warning打印

1.1.8

  1. 处理未进行预加载初始化时无法打开游戏的情况

1.1.5

  1. 增加预加载功能

1.1.4

  1. 增加错误上报

1.1.3

  1. gameSendScreenshot接口增加用户id和房间id

1.1.2

  1. 增加开始游戏透传枚举 cf_app_call_game_ext
  2. 删除无用的websocket连接

1.1.1

package.json修改

1.1.0

  1. APP_CALL_GAME等新接口
  2. 接入语音识别

安装

npm i luksdk-web

用法

import LuksSdk from 'luksdk-web';
/**
 * appId: 接入方 AppID,可联系对接人员获取
 * language: 暂无用处; 如要设置游戏内的语言,请参考"设置业务回调接口"里的"getBaseInfo"
 * apiUrl: 对接人员提供的测试服或正式服域名,格式为"https://xxxxxx", 不需要加"/sdk"
 * wsUrl: 弃用,不填即可
 */
const luksSdk = new LuksSDK(1, 'zh_CN', 'https://api.example.com')

CDN 用法

<script src="https://unpkg.com/luksdk-web@latest/dist/luksSdk-iife.js"></script>
<script>
    const luksSdk = new LuksSDK(1, 'zh_CN', 'https://api.example.com')
</script>

Api 方法

初始化

    // (appId: number, language: string, apiUrl:string, wsUrl:string)
    const luksSdk = new LuksSDK(1, 'zh_CN', "xxx")

设置用户信息(Promise)

    // (userId: string, userCode: string)
    luksSdk.setUserInfo('123', '123')

设置业务回调接口

    /**
     * 
    * export interface ICFBizCallback {
        onOpenChargePage?: () => void | Promise<void>
        onGetCurrentRoomId?: () => string | Promise<string>
        onIsRoomOwner?: () => boolean | Promise<boolean>
        onWindowSafeArea?: () => SafeArea | Promise<SafeArea>
        getBaseInfo?: (data?) => BaseInfo | Promise<BaseInfo>
    }
    * export interface SafeArea {
        left?: number, //窗口左边至游戏区域的距离
        top?: number,   //窗口顶部至游戏区域的距离
        right?: number, //窗口右边至游戏区域的距离
        bottom?: number, //窗口底部至游戏区域的距离
        scaleMinLimit: number //游戏区域缩放的最小倍数
    }

    export interface BaseInfo {
        cid: string,     //渠道id
        gid: string,     //游戏id
        uid: string,     //渠道用户id
        token: string,   //sdk平台令牌
        version: string, //客户端sdk版本号
        language: string,//语言
        window: string,   //窗囗大小->"宽度x高度'
        rid: string,     //当前房间号
        room_owner: boolean, //是否房主
        ext: string, // 接入方透传数据
    }
    */
   luksSdk.setBizCallback(callback: ICFBizCallback)

拉起一个游戏列表弹窗,其中包含接入方已获得授权的所有游戏

  • 待完善

从服务端获取游戏列表信息(Promise)

    luksSdk.getGameList()

加载半屏游戏(Promise)

    // container: '.className' || document.getElementById('receiver')
    luksSdk.startHalfWindowGame(container: string | HTMLElement, gameId: string, url: string)

加载全屏游戏(Promise)

    // container: '.className' || document.getElementById('receiver')
    luksSdk.startFullWindowGame(container: string | HTMLElement, gameId: string, url: string)

加载横屏游戏(Promise)

    // container: '.className' || document.getElementById('receiver')
    luksSdk.startLandscapeWindowGame(container: string | HTMLElement, gameId: string, url: string)

日志回调

    /**
     * export type LogFn = (tag: string, msg: string) => void
        export interface ICFLogger {
            onDebug?: LogFn
            onInfo?: LogFn
            onWarn?: LogFn
            onError?: LogFn
        }
     */
    luksSdk.setLogger(logger: ICFLogger)

游戏生命周期回调

    /**
     * export interface PreJoinGameRes {
        is_ready: boolean;
        seat: number;
    }

    export interface ICFGameLifecycle {
        onGameLoadFail?: () => void 
        onPreJoinGame?: (userId: string, seat: number) => PreJoinGameRes | Promise<PreJoinGameRes>
        onJoinGame?: (userId: string) => void 
        onGamePrepare?: (userId: string) => void 
        onCancelPrepare?: (userId: string) => void 
        onGameTerminated?: (userId: string) => void 
        onGameOver?: () => void 
        onGameDidFinishLoad?: () => void 
        getGameloadProgress?: (progress: number) => void 
        onSeatAvatarTouch?: (userId: string, seat: number) => void 
        closeGamePage?: () => void 
        gameStateChange?: (parameter: string) => void 
        playerStateChange?: (parameter: string) => void 
        gameLoadSuccess?: () => void 
        gameSendScreenshot?: (base64:string,json:{uid:string,rid:string}) =>void
        onGameMusicStartPlay?: (musicId: number,musicUrl:string,isLoop:boolean) => void
        onGameMusicStopPlay?: (musicId: number) => void
        onGameEffectSoundStartPlay?: (effectId: number,soundUrl:string,isLoop:boolean) => void
        onGameEffectSoundStopPlay?: (effectId: number) => void
    }
     */
    luksSdk.setCFGameLifecycle(lifecycle: ICFGameLifecycle)

推拉流接口

    /**
        export interface RTCSelfRes {
            push:boolean;
            complete: boolean;
        }
        export interface RTCOtherRes {
            userId:string,
            pull:boolean;
            complete: boolean;
        }
     *  export interface ICFRTCCallback {
            onCFGamePushSelfRTC?: (push: boolean) => RTCSelfRes | Promise<RTCSelfRes>
            onCFGamePullOtherRTC?: (userId: string, pull: boolean) => RTCOtherRes | Promise<RTCOtherRes>
        }
     */
    luksSdk.setRTCCallback(callback: ICFRTCCallback)

销毁游戏

    luksSdk.destroyGame()

重新加载游戏

    luksSdk.gameReload(): void;

刷新用户信息

    luksSdk.refreshUserInfo()

开始游戏

    luksSdk.gameStart()

移除游戏玩家

    luksSdk.playerRemove(userId: string)

是否关闭游戏背景音乐

    luksSdk.gameBackgroundMusicSet(open: boolean)

是否关闭游戏音效

    luksSdk.gameSoundSet(open: boolean)

设置游戏角色

    luksSdk.setPlayerRole(role: number)

退出游戏

    luksSdk.quitGame(userId: string)

终止游戏

    luksSdk.terminateGame(userId: string)

加入游戏

    luksSdk.joinGame(seatIndex: number)

暂停游戏(仅单机类游戏)

    luksSdk.pauseGame()

继续游戏 (用于结束暂停的状态)(仅单机类游戏)

    luksSdk.playGame()

SDK控制游戏专题接口

    appCallGame<T extends keyof AppCallGameDataType>({ state, data }: {state: T, data?: AppCallGameDataType[T]}): void;

获取ASR临时token

    onGetSpeechToken(): Promise<undefined>;

ASR初始化接口

    gameASRStartWithLanguages(language: LanguagesType): Promise<undefined>;

语音识别

    //初始化语音识别,传入语音参数
    luksSdk.gameASRStartWithLanguages(language: LanguagesType)
    //传入base64格式的pcm数据,识别到的词语会发送给游戏
    luksSdk.onPushAudioData(pcmData: any)
    //停止识别
    luksSdk.onASREnd()