ProfilerPlugin

View source

ExtendsPlugin

Adds browser profiling to an App.

Registering this plugin makes a Profiler resource and a repeating ProfilerTimer resource available to the app. The timer uses a one-second cycle to refresh a browser viewer attached to document.body.

The viewer lists each recorded profile label with its most recent measured duration in milliseconds. Registration requires a browser document with a document.body.

Register CorePlugin, ReflectPlugin, and TimePlugin before this plugin. Registering ProfilerPlugin does not install those dependencies automatically.

Examples

import { App } from '@wimaengine/app'
import { CorePlugin } from '@wimaengine/core'
import { ProfilerPlugin } from '@wimaengine/profiler'
import { ReflectPlugin } from '@wimaengine/reflect'
import { TimePlugin } from '@wimaengine/time'

new App()
  .registerPlugin(new ReflectPlugin())
  .registerPlugin(new CorePlugin())
  .registerPlugin(new TimePlugin())
  .registerPlugin(new ProfilerPlugin())

Constructor


constructor()

Methods


register(app: App): void

View source

Configures the app during the registration phase of App#run.

PluginRegistry calls this hook for each registered plugin in insertion order, before it validates any Plugin#requires IDs. A hook can use the app’s registration methods to configure worlds and resources, install component hooks, and stage schedules with execution callbacks for the app runner. It can also call App#registerPlugin to add a nested plugin. The registry continues through plugins added during this pass, and those plugins also reach the later Plugin#finish pass. Return values are ignored.

Parameters

NameDescriptionDefault
app

App that receives the profiler resources and viewer.

—

Returns

This hook’s return value is ignored.

requires(): TypeId[]

View source

Returns plugin IDs that must already be registered before finalization.

App#run asks PluginRegistry to validate every returned ID after all registration hooks complete and before any finish hook runs. A missing ID causes run to throw; IDs do not cause plugins to be installed, and this list does not reorder plugin hooks. The base implementation has no dependencies.

Returns

Required plugin type IDs.