How to use the ice.Ice.Promise function in ice

To help you get started, we’ve selected a few ice examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github zeroc-ice / ice-demos / js / Ice / bidir / Client.js View on Github external
}

let communicator;

//
// Exit on SIGINT or SIGBREAK
//
process.on(process.platform == "win32" ? "SIGBREAK" : "SIGINT", () =>
    {
        if(communicator)
        {
            communicator.destroy().finally(() => process.exit(0));
        }
    });

Ice.Promise.try(() =>
    {
        communicator = Ice.initialize(process.argv);
        if(process.argv.length > 2)
        {
            throw("too many arguments");
        }
        //
        // Initialize the communicator and create a proxy to the sender object.
        //
        const proxy = communicator.stringToProxy("sender:tcp -p 10000");

        //
        // Down-cast the proxy to the Demo.CallbackSender interface.
        //
        return Demo.CallbackSenderPrx.checkedCast(proxy).then(server =>
            {
github zeroc-ice / ice-demos / js / Ice / bidir / Client.js View on Github external
).catch(ex =>
    {
        console.log(ex.toString());
        Ice.Promise.try(() =>
            {
                if(communicator)
                {
                    return communicator.destroy();
                }
            }
        ).finally(() => process.exit(1));
    });