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

elephant-game-framework

v4.0.0

Published

- 框架初始化

Readme

大象互动游戏框架

  • 框架初始化
// 创建全新的FeatureCenter
let featureCenter = FeatureHelper.buildFeatureCenter(AllFeatures) // 对应需要使用的FeatureCenter类
    .appendConfig(featureNames.Logging, { logConfig: EnvConfig.logConfig } as ILoggingFeatureConfig) // 调用appendConfig方法,添加FeatureConfig以配置各个Feature
    .appendConfig(featureNames.Advertise, EnvConfig.advertiseConfig)
    .build(); // 调用build生成featureCenter实例
GameFramework.initializeFramework(featureCenter); // 使用生成的featureCenter和特定的配置,初始化框架
  • 调用 Feature 方法
// 通过FeatureHelper来执行对Feature的调用
let loginRet: boolean = await FeatureHelper.invokeFeature<LoginFeature>(
    featureNames.Login,
    (loginFeature: LoginFeature) => {
        return loginFeature.tryLogin(relogin);
    },
    false
);
  • 日志
let logger = new FeatureLogger('test'); // FeatureLogger是日志类,test为日志对象名
logger.debug('debug log');
logger.info('info log');
logger.warn('warn log');
logger.error('error log');
logger.fatal('fatal log');
// 默认打印的日志格式:
[D - test@Feature] : debug info
  • API 接口
class TestApi extends ApiBase {
    construct() {
        super('test', '/test'); // ‘test’是api名称,日志打印会使用该名称;'/test'是Api的相对url路径
    }

    public getTestInfo(): Promise<any> {
        return this.get('/info'); // 调用get方法,发起一个get请求获取信息,返回对象是any
    }
}

更新日志

  • 1.2.1

    • 优化框架导出
  • 1.2.0

    • 修复 SDK 初始化失败的问题(Feature 参数获取失败)
    • 添加 SDK 加载的统计上报(开始加载/完成加载)
    • 优化框架代码组织结构
  • 1.1.3

    • 修复观察者模式通知消息遍历的隐藏 BUG
  • 1.1.2

    • 优化观察者模式模块的错误日志
  • 1.1.0

    • 增加性能监控模块(本地调试版本)
  • 1.0.0

    游戏框架第一版