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

sfml.js-interop

v1.3.1

Published

Shared native interop headers for sfml.js and its addons.

Readme

sfml.js-interop

npm version

English · 简体中文 · 日本語 · 한국어

为 sfml.js 及其插件(如 sfml.js-imgui)提供共享原生头文件和 SFML SDK 路径。应用通常直接使用 JavaScript 包;本软件包面向原生扩展作者。

完整互操作指南 · 开发指南

用法

在扩展中声明 sfml.js-interop 依赖。与 nan 类似,require 本软件包会返回它的 include 目录:

const includeDir = require('sfml.js-interop');

require('sfml.js-interop/paths') 导出已解析的 SDK 路径:

| 导出 | 路径 | | --- | --- | | root | 包含已下载 SDK 的软件包根目录 | | include | 互操作头文件目录 | | sfmlInclude | SFML C++ 头文件 | | sfmlLib | SFML 链接库 | | sfmlBin | SFML 运行时二进制文件 |

在 binding.gyp 中引用这两个 include 目录,不要硬编码兄弟仓库的私有头文件:

{
  "include_dirs": [
    "<!(node -e \"process.stdout.write(require('sfml.js-interop'))\")",
    "<!(node -e \"process.stdout.write(require('sfml.js-interop/paths').sfmlInclude)\")"
  ]
}

契约

  • sfml-js-interop.h 提供 SFMLJS_INTEROP_VERSION(当前为 2),并导入 shared-handle.h、exception-boundary.h、numeric-fields.h 和 window-event-source.h。
  • window-event-source.h 在扩展之间传递不透明的原生事件来源。在 macOS 上,按键和文本的来源随实际 SFML 队列项及轮询生成的 JS 快照保留;通过公开 Event 构造函数复制的事件保持独立。
  • 扩展需匹配宿主绑定所用的契约与 SFML 版本。版本宏相同本身不保证不同构建配置的二进制之间 ABI 兼容。
  • RenderWindowFrom 接收绑定内部的原生窗口句柄,不接收公开的 JavaScript RenderWindow 对象。
  • 原生拥有者管理生命周期:视图和借用指针不能超出其拥有者、上下文或窗口的生命周期。
  • 已录制绘制需要保活资源、保持调用时快照;向 V8 暴露 C++ 回调时使用共享异常边界。

SDK 下载器归本软件包管理;Rush 先构建 interop,再构建 sfml.js 和 sfml.js-imgui。完整消费示例见集成源码和 JS 桥接。

许可证

MIT。