npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

mql5-promise

v1.0.0

Published

An interface for implementing asynchronous execution of algorithms for mql5, like Promise in JavaScript.

Readme

An interface for implementing asynchronous execution of algorithms for mql5, like Promise in JavaScript.

Example Promise :

void OnInit() {
    new Promise(printAndTimoutResolve, "111")
        .then(printAndReject, "222") // then - run if prev promise is resolved
        .ccatch(printAndResolve, "333") // ccatch - run if prev promise is rejected
        .ccatch(printAndResolve, "444")
        .ccatch(printAndResolve, "555")
        .then(printAndResolve, "666")
        .finally(printAndResolve, "end") // finally - run anything
        .destroy(); // clear memory theese promises after execution all promises

    Print("start");

    // printAndTimoutResolve 111   // timeout after Print
    // start
    // printAndReject 222
    // printAndTimoutResolve 333
    // printAndTimoutResolve 666
    // printAndTimoutResolve end
};

void promiseAllResolve(ulong promiseId, string &prevResult[], string parametr) {
    Print("promiseAllResolve " + parametr);
};

void printAndTimoutResolve(ulong promiseId, string prevResult, string parametr) {
    Print("printAndTimoutResolve " + parametr);
    Timer::setTimout(resolveByIdStr, 2000, string(promiseId));
};
void resolveByIdStr(string id) { Promise::resolveById(ulong(id)); }

void printAndResolve(ulong promiseId, string prevResult, string parametr) {
    Print("printAndResolve " + parametr);
    Promise::resolveById(promiseId);
};

void printAndReject(ulong promiseId, string prevResult, string parametr) {
    Print("printAndReject " + parametr);
    Promise::rejectById(promiseId);
};

Example Promise:all :

void OnInit() {
    Promise* list1[] = {
        new Promise(printAndTimoutResolve, "Promise 1")
            .then(printAndTimoutResolve, "Promise 1.1")
        ,
        new Promise(printAndReject, "Promise 2"),
        new Promise(printAndTimoutResolve, "Promise 3"),
    };

    Promise::all(list1, promiseAllResolve) // resolve if all promises are resolved
        .then(printAndResolve, "Promise::all resolved")
        .ccatch(printAndResolve, "Promise::all rejected")
        .destroy(); // delete all promises

    // printAndTimoutResolve Promise 1
    // printAndReject Promise 2
    // printAndTimoutResolve Promise 3
    // printAndResolve Promise::all rejected
};

Example Promise:race :

void OnInit() {
    Promise* list2[] = {
        new Promise(printAndTimoutResolve, "Promise 1")
            .then(printAndTimoutResolve, "Promise 1.1")
        ,
        new Promise(printAndReject, "Promise 2"),
        new Promise(printAndTimoutResolve, "Promise 3"),
    };

    Promise::race(list2, printAndResolve, "Promise::race") // resolve/reject after the first promise
        .then(printAndResolve, "Promise::race resolved")
        .ccatch(printAndResolve, "Promise::race rejected")
        .destroy();

    // printAndTimoutResolve Promise 1
    // printAndReject Promise 2
    // printAndTimoutResolve Promise 3
    // Promise::race rejected
};

Example Promise:any :

void OnInit() {
    Promise* list3[] = {
        new Promise(printAndTimoutResolve, "Promise 1")
            .then(printAndTimoutResolve, "Promise 1.1")
        ,
        new Promise(printAndReject, "Promise 2"),
        new Promise(printAndTimoutResolve, "Promise 3"),
    };

    Promise::any(list3, printAndResolve, "Promise::any")
        .then(printAndResolve, "Promise::any resolved")
        .ccatch(printAndResolve, "Promise::any rejected")
        .destroy();

    // printAndTimoutResolve Promise 1
    // printAndReject Promise 2
    // printAndTimoutResolve Promise 3
    // printAndResolve Promise::any
    // printAndResolve Promise::any resolved
};