Skip to main content

Class: ButtonPushAfterEventSignal

Manages callbacks that are connected to when a button is pushed.

Example

import { world, ButtonPushAfterEvent, system } from '@minecraft/server';

world.afterEvents.buttonPush.subscribe((buttonPushEvent: ButtonPushAfterEvent) => {
const eventLoc = buttonPushEvent.block.location;

world.sendMessage(
`Button push event at tick ${system.currentTick} Power:${buttonPushEvent.block.getRedstonePower()}`,
);
});

Extends

Constructors

new ButtonPushAfterEventSignal()

private new ButtonPushAfterEventSignal(): ButtonPushAfterEventSignal

Returns

ButtonPushAfterEventSignal

Overrides

IButtonPushAfterEventSignal . constructor

Methods

subscribe()

subscribe(callback): (arg) => void

Parameters

ParameterType
callback(arg) => void

Returns

Function

Parameters
ParameterType
argButtonPushAfterEvent
Returns

void

Inherited from

IButtonPushAfterEventSignal . subscribe

Remarks

Subscribes to the event.

This function can't be called in read-only mode.


unsubscribe()

unsubscribe(callback): void

Parameters

ParameterType
callback(arg) => void

Returns

void

Inherited from

IButtonPushAfterEventSignal . unsubscribe

Remarks

Unsubscribes from the event.

This function can't be called in read-only mode.

Throws

This function can throw errors.