@pumpkin-plugins/upnpumpkin-api API / watcher / MappingWatcher
Class: MappingWatcher
Defined in: tools/upnpumpkin-api/src/watcher.ts:14
Keeps asking UPnPumpkin about one port and tells you when the answer changes. It copes with UPnPumpkin loading after your plugin, being reloaded, or not being installed at all.
Constructors
Constructor
new MappingWatcher(
client,request,onChange,now):MappingWatcher
Defined in: tools/upnpumpkin-api/src/watcher.ts:20
Creates a stopped watcher.
Parameters
client
request
onChange
(state) => void
now
() => number
Returns
MappingWatcher
Accessors
state
Get Signature
get state():
WatchedState|undefined
Defined in: tools/upnpumpkin-api/src/watcher.ts:28
The latest state, or undefined before the first answer.
Returns
WatchedState | undefined
Methods
start()
start():
void
Defined in: tools/upnpumpkin-api/src/watcher.ts:33
Starts asking. The first check happens at once.
Returns
void
stop()
stop(
options?):void
Defined in: tools/upnpumpkin-api/src/watcher.ts:52
Stops asking and optionally tells UPnPumpkin to close the port. Safe to call twice.
Parameters
options?
releasePort?
boolean
Returns
void
tick()
tick():
void
Defined in: tools/upnpumpkin-api/src/watcher.ts:40
Checks again when it is time. Call once per game tick.
Returns
void