A simple and fast pmmp js es6 promise virion

Overview

Promises

A simple and fast pmmp js es6 promise virion

Api usage

these examples are in base injectable php these should be easily transferable.

Example usage of Promise::then(callable)

then(function ($string) { echo $string; // should print "hello" }); ">
use Jviguy\Promises\Promise;
class A {
    /**
    * @return Promise
   
     - a promise containing a string
   
    */
    public static function foo(): Promise {
        return new Promise(fn() => "hello");
    }
}

A::foo()->then(function ($string) {
    echo $string; // should print "hello"
});

Example usage of Promise::catch(callable(Exception))

catch(function (Exception $error) { echo "an error has a occurred message: "; echo $error->getMessage(); }); ">
use Jviguy\Promises\Promise;
class A {
    /**
    * @return Promise
   
     - a promise containing a string
   
    */
    public static function foo(): Promise {
        return new Promise(fn() => throw new Exception("testing exception"));
    }
}

A::foo()->catch(function (Exception $error) {
    echo "an error has a occurred message: ";
    echo $error->getMessage();
});
You might also like...
PocketMine-MP virion for easy handling of ScoreBoard packets

PocketMine-MP virion for easy handling of ScoreBoard packets

New TapToDo for PMMP 4.0 API Minecraft.

TapToDo - v2.4.2 New TapToDo for PMMP 4.0 API Minecraft. Features: Simple and user-friendly very easy setup Add macros on block Work in game Tap to se

Powerful land plugin, based on PMMP.

iLand Powerful land plugin, based on PMMP Features Land management with Form UI The border of the selected land Custom land settings Customize the per

InventoryUI - the PocketMine virion that implements the dummy inventory

InventoryUI This is the PocketMine virion that implements the dummy inventory. Differences from previous APIs Chests and other blocks are not placed.

UI virion (library) for PocketMine-MP plugins
UI virion (library) for PocketMine-MP plugins

Remark - Easy and Asynchronous Commands and Forms Quick Guide - Learn Remark by building a plugin. Install - Add Remark as a library to your plugin. E

Powerful land plugin, based on PMMP.

iLand Powerful land plugin, based on PMMP Features Land management with Form UI The border of the selected land Custom land settings Customize the per

A plugin OreSpawner for PocketMine-PMMP
A plugin OreSpawner for PocketMine-PMMP

A plugin OreSpawner for PocketMine-PMMP

Jump is yet another self-hosted startpage for your server designed to be simple, stylish, fast and secure.
Jump is yet another self-hosted startpage for your server designed to be simple, stylish, fast and secure.

Jump Jump is yet another self-hosted startpage for your server designed to be simple, stylish, fast and secure. Features Fast, easy to deploy, secure

Tiny, fast and simple PHP boilerplate built on top of FlightPHP

BlessPHP Tiny, fast and simple PHP boilerplate built on top of FlightPHP. Good enough to use as skeleton for prototypes and some pet-projects. The nam

Owner
young software developer with Mastery in golang, Java, PHP, and Javascript.
null
[virion] It Implements Simple Using Form Library System

SimpleForm [virion] It Implements Simple Using Form Library System How To Use First, declare the use statement. use AidenKR\SimpleForm\SimpleForm; use

Aiden 2 Sep 18, 2021
A virion for PocketMine-MP to create and manage fake blocks

?? fakeblocks Create and manage fakeblocks Description: A virion for PocketMine-MP to create and manage fake blocks. This virion indicates to the clie

null 13 Nov 16, 2022
A Pocketmine-MP (PMMP) plugin to help staff members enforce the rules of the server.

StaffMode is an all-in-one Pocketmine-MP (PMMP) moderation plugin made to simplify the life of staff members.

ItsMax123 9 Sep 17, 2022
A Pocketmine-MP (PMMP) plugin to prevent players from doing most glitches.

AntiGlitch AntiGlitch is an all-in-one Pocketmine-MP (PMMP) plugin made to prevent as many known glitches. Setup Guide To start using the plugin, down

ItsMax123 12 Sep 17, 2022
A Pocketmine-MP (PMMP) leaderboard plugin that shows player statistics on a website.

WebLeaderBoard A Pocketmine-MP (PMMP) leaderboard plugin that shows all sorts of statistics on a website. Setup Guide To start using the plugin, downl

ItsMax123 6 Apr 5, 2022
PMMP 4.0.0

InventoryAPI PocketMine-MP APIv4.0.0 Example OneBlockInventory use pocketmine\block\BlockLegacyIds; use pocketmine\player\Player; use pocketmine\netw

null 14 Dec 26, 2022
Cooldown Library (virion) for PocketMine-MP

libCooldown Cooldown Library (virion) for PocketMine-MP Example // libCooldown::newTimer(int $cooldown_time, bool $first_ignore = true): libCooldown;

null 4 Aug 9, 2022
Plugins for NostalgiaCore/PMMP 1.3.11

NostalgiaPlugins Plugins for NostalgiaCore/PMMP 1.3.11 Special thx to SkilasticYT ColorCarpet: Author: ArkQuark Description: Paints blocks of wool and

null 5 Aug 6, 2022
[Virion] A library that helps you use Discord Webhook

DiscordHelper How to register Web Hook URL How to register Web Hook URL use NewThing\DiscordHelper\DiscordHelper; DiscordHelper::setURL($YourWebHookU

null 1 Dec 25, 2021
A virion for PocketMine-MP.

libIPGeolocation A virion for PocketMine-MP. You can use this to get the geolocation of an IP from ip-api.com. Usage You can see some example in here:

Hsinwei Chen 3 Feb 14, 2022