# @mcbe/nexttick

> set callback when next update

Latest version **2.0.8** (published 2021-01-16) · ISC license · 0 weekly downloads

## Install

```sh
npm install @mcbe/nexttick
pnpm add @mcbe/nexttick
yarn add @mcbe/nexttick
bun add @mcbe/nexttick
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.0.8 |
| Published | 2021-01-16 |
| First published | 2019-09-30 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Unpacked size | 3.4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 4 |
| Author | ruakr |
| Maintainers | karikera |

## Links

- npm: https://www.npmjs.com/package/@mcbe/nexttick
- Repository: https://github.com/karikera/mcbe_modules
- Homepage: https://github.com/karikera/mcbe_modules#readme
- Issues: https://github.com/karikera/mcbe_modules/issues
- npm.io page: https://npm.io/package/@mcbe/nexttick

## Dependencies (2)

- [@mcbe/event](https://npm.io/package/@mcbe/event.md) ^2.0.8
- [@mcbe/dummy-console](https://npm.io/package/@mcbe/dummy-console.md) ^2.0.4

## Recent versions

- 2.0.8 (latest) — 2021-01-16
- 2.0.4 — 2020-12-23
- 2.0.2 — 2020-12-23
- 2.0.1 — 2020-12-23
- 1.0.6 — 2020-04-11
- 1.0.5 — 2019-10-06
- 1.0.4 — 2019-10-06
- 1.0.3 — 2019-10-03
- 1.0.2 — 2019-10-02
- 1.0.1 — 2019-10-01
- 1.0.0 — 2019-09-30

## README

## About this
set callback when next update

## Example

```ts

/// <reference path="../../node_modules/minecraft-scripting-types-server/index.d.ts" />

import { callAtNextTick } from '@mcbe/nexttick';
import events from '@mcbe/event_server';
import { system } from '@mcbe/system_server';

events.listen.EntityCreated(entity=>{
    if (entity.entity.__identifier__ === 'minecraft:arrow') // when arrow is created
    {
        // if you delete arrow instantly, minecraft will crash (1.12)
        // it needs to wait to next tick
        callAtNextTick(()=>{
            system.destroyEntity(entity.entity);
        });
    }    
});


```

## @mcbe/event dependency
`@mcbe/event` will freeze system object to prevent modifiying `initialize` `update` `shutdown` functions.  
```ts
// please use
import { sharedEvents } from "@mcbe/event";
sharedEvents.initialize.on(()=>{ /* codes */ });
sharedEvents.update.on(()=>{ /* codes */ });
sharedEvents.shutdown.on(()=>{ /* codes */ });
// instead of 
system.initialize = ()=>{ /* codes */ };
system.update = ()=>{ /* codes */ };
system.shutdown = ()=>{ /* codes */ };
```

---
_Source: https://npm.io/package/@mcbe/nexttick · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
