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

bf6-portal-utils

v7.1.1

Published

Battlefield 6 Portal Utils

Readme

Battlefield Portal Utils

This repository hosts and maintains custom libraries, tools, examples, and documentation for use with Battlefield 6's Portal. Whether you're building a new Portal experience or enhancing an existing one, these utilities aim to simplify common development tasks and provide robust, well-tested solutions for UI creation, debugging, and more.

Contents

This repository is organized into focused modules, each addressing specific development needs:

  • Events Module – A centralized event subscription system that allows multiple handlers to subscribe to the same Battlefield Portal event. This module implements all handlers once and exposes a subscription API, enabling modular code organization, clean separation of concerns, and ensures various handlers execute asynchronously without blocking each other.

  • FFA Spawning Module – Enables Free For All (FFA) spawning for custom Battlefield Portal experiences by short-circuiting the normal deploy process in favor of a custom UI prompt. Uses an intelligent algorithm to find safe spawn points that are appropriately distanced from other players, reducing the chance of spawning directly into combat. It also handles AI players.

  • Logger Module – A powerful logging system that displays runtime text directly on-screen, solving Battlefield Portal's debugging limitations. Works on all platforms, including console builds.

  • Logging Module – A fail-safe logging abstraction that provides configurable log level filtering and error handling for Battlefield Portal experiences. Can be used directly in mods or integrated into other modules to provide consistent, safe logging functionality that prevents logging failures from crashing your mod.

  • Map Detector Module – Detects the current map by analyzing the coordinates of Team 1's Headquarters (HQ), providing a reliable alternative to the broken mod.IsCurrentMap API. Supports detection of all available maps with fast, coordinate-based identification.

  • Multi-Click Detector Module – Detects when a player has rapidly triggered a soldier state multiple times in quick succession. By default monitors the interact state, enabling custom UI triggers and special actions without relying on in-world physical interaction points. Supports configurable soldier states, time windows, and click counts for flexible multi-click detection.

  • Performance Stats Module – Monitors and tracks the estimated runtime tick rate of the server, providing real-time performance metrics that help identify when the server is under stress or when script callbacks are being deprioritized by the game engine.

  • Raycast Module – Abstracts Battlefield Portal's raycasting functionality with automatic hit/miss attribution to the correct rays. Handles attribution mechanics, manages time-to-live for rays, and provides a clean callback-based API to make it easier to perform mass obstacle detection, line of sight checks, and interactive object detection.

  • Scavenger Drop Module – Detects when a player scavenges a dead player's kit bag by monitoring proximity to dead bodies. Provides automatic detection with performance-optimized checking that scales frequency based on distance, configurable callbacks for custom actions (such as ammo resupply), and automatic cleanup when drops expire or are scavenged.

  • SolidUI Module – A reactive UI framework inspired by SolidJS, providing fine-grained reactivity for Battlefield Portal UIs. Uses signals, effects, memos, and stores to create dynamic interfaces that update only the specific properties that change, resulting in minimal overhead and maximum performance. Integrates seamlessly with the UI Module.

  • Sounds Module – Abstracts away the nuance, oddities, and pitfalls of playing sounds at runtime in Battlefield Portal experiences. Provides efficient sound object management through automatic pooling and reuse, handles different playback scenarios (2D global, 2D per-player/squad/team, and 3D positional), and manages sound durations automatically.

  • Timers Module – Reintroduces setTimeout and setInterval functionality into BF6 Portal; the familiar JavaScript API makes code more readable and maintainable. It offers significant advantages over mod.Wait() since timers can be cancelled and multiple timers can run concurrently without blocking. Ideal for periodic tasks, delayed actions, debouncing, etc.

  • UI Module – Object-oriented TypeScript wrappers around Battlefield Portal's UI APIs, providing strongly typed helpers, convenient defaults, and ergonomic interfaces for building complex HUDs, panels, and interactive buttons. Features automatic naming and UI input mode management, eliminating the need to manually track and enable/disable scoped UI input mode when elements are shown or hidden. Includes a growing list of components in subdirectories (containers, buttons, text, images, etc.) that can be separately imported for modular UI construction.

Getting Started

Each module includes its own comprehensive README with:

  • Prerequisites and setup instructions
  • Usage examples and code snippets
  • Complete API reference documentation
  • Best practices and common patterns

Browse the module directories above to get started with any specific tool, or explore the repository to discover what's available.

Contributing

Questions, feature requests, and bug reports are very welcome!

We're actively maintaining these utilities and rely on community feedback to prioritize improvements and fix issues. Whether you've found a bug, have an idea for a new feature, or just need help getting started, please don't hesitate to reach out.

  • Open an issue for bug reports or feature requests
  • Ask questions in discussions or issues
  • Share your use cases and success stories—they help shape the roadmap