当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript chalk.bgWhite类代码示例

本文整理汇总了TypeScript中chalk.bgWhite的典型用法代码示例。如果您正苦于以下问题:TypeScript bgWhite类的具体用法?TypeScript bgWhite怎么用?TypeScript bgWhite使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了bgWhite类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。

示例1: callback

            this._internal_create_secure_channel(infiniteConnectionRetry, (err?: Error | null) => {

                if (err) {
                    if (err.message.match("ECONNREFUSED")) {
                       return callback(err);
                    }
                    if (err.message.match("Backoff aborted.")) {
                        return failAndRetry(err!, "cannot create secure channel");
                    }
                    if (true || err!.message.match("BadCertificateInvalid")) {
                        errorLog(" _internal_create_secure_channel err = ", err.message);
                        // the server may have shut down the channel because its certificate
                        // has changed ....
                        // let request the server certificate again ....
                        debugLog(chalk.bgWhite.red("ClientBaseImpl: Server Certificate has changed." +
                          " we need to retrieve server certificate again"));

                        return this.fetchServerCertificate(this.endpointUrl, (err1?: Error | null) => {
                            if (err1) {
                                return failAndRetry(err1, "trying to fetch new server certificate");
                            }
                            this._internal_create_secure_channel(infiniteConnectionRetry, (err3?: Error | null) => {
                                if (err3) {
                                    return failAndRetry(err3, "trying to create new channel with new certificate");
                                }
                                callback();
                            });
                        });

                    }
                    debugLog(chalk.bgWhite.red("ClientBaseImpl: cannot reconnect .."));
                    failAndRetry(err!, "cannot create secure channel");

                } else {

                    /**
                     * notify the observers that the reconnection process has been completed
                     * @event after_reconnection
                     * @param err
                     */
                    this.emit("after_reconnection", err); // send after callback
                    assert(this._secureChannel, "expecting a secureChannel here ");
                    // a new channel has be created and a new connection is established
                    debugLog(chalk.bgWhite.red("ClientBaseImpl:  RECONNECTED                !!!"));
                    return callback();
                }
            });
开发者ID:node-opcua,项目名称:node-opcua,代码行数:47,代码来源:client_base_impl.ts

示例2: file_line

/**
 * file_line return a 51 caracter string
 * @param filename
 * @param callerLine
 */
function file_line(mode: "E" | "D", filename: string, callerLine: number): string {
    const d = (new Date()).toISOString().substr(11);
    if (mode === "D") {
        return chalk.bgWhite.cyan(w(d, 14) + ":" + w(filename, 30) + ":" + w(callerLine.toString(), 5));
    } else {
        return chalk.bgRed.white(w(d, 14) + ":" + w(filename, 30) + ":" + w(callerLine.toString(), 5));
    }
}
开发者ID:node-opcua,项目名称:node-opcua,代码行数:13,代码来源:make_loggers.ts

示例3: debugLog

 client.__createSession_step2(session, (err: Error | null, session1?: ClientSessionImpl) => {
     debugLog(chalk.bgWhite.cyan("    => creating a new session (based on old session data).... Done"));
     if (!err && session1) {
         newSession = session1;
         assert(session === session1, "session should have been recycled");
     }
     innerCallback(err ? err : undefined);
 });
开发者ID:node-opcua,项目名称:node-opcua,代码行数:8,代码来源:reconnection.ts

示例4: suspend_old_session_publish_engine

 function suspend_old_session_publish_engine(innerCallback: ErrorCallback) {
     if (session.hasBeenClosed()) {
         return innerCallback(new Error("Cannot complete subscription republish due to session termination"));
     }
     debugLog(chalk.bgWhite.red("    => suspend old session publish engine...."));
     session.getPublishEngine().suspend(true);
     innerCallback();
 },
开发者ID:node-opcua,项目名称:node-opcua,代码行数:8,代码来源:reconnection.ts

示例5: activate_new_session

        function activate_new_session(innerCallback: ErrorCallback) {

            if (session.hasBeenClosed()) {
                return innerCallback(new Error("Cannot complete subscription republish due to session termination"));
            }
            debugLog(chalk.bgWhite.red("    => activating a new session ...."));

            client._activateSession(newSession, (err: Error | null, session1?: ClientSessionImpl) => {
                debugLog(chalk.bgWhite.cyan("    =>  activating a new session .... Done"));
                innerCallback(err ? err : undefined);
            });
        },
开发者ID:node-opcua,项目名称:node-opcua,代码行数:12,代码来源:reconnection.ts

示例6: create_new_session

        function create_new_session(innerCallback: ErrorCallback) {
            if (session.hasBeenClosed()) {
                return innerCallback(new Error("Cannot complete subscription republish due to session termination"));
            }

            debugLog(chalk.bgWhite.red("    => creating a new session ...."));
            // create new session, based on old session,
            // so we can reuse subscriptions data
            client.__createSession_step2(session, (err: Error | null, session1?: ClientSessionImpl) => {
                debugLog(chalk.bgWhite.cyan("    => creating a new session (based on old session data).... Done"));
                if (!err && session1) {
                    newSession = session1;
                    assert(session === session1, "session should have been recycled");
                }
                innerCallback(err ? err : undefined);
            });
        },
开发者ID:node-opcua,项目名称:node-opcua,代码行数:17,代码来源:reconnection.ts

示例7:

 client.on("start_reconnection", () => {
     console.log(chalk.bgWhite.red(" !!!!!!!!!!!!!!!!!!!!!!!!  Starting Reconnection !!!!!!!!!!!!!!!!!!!"));
 });
开发者ID:node-opcua,项目名称:node-opcua,代码行数:3,代码来源:simple_client.ts

示例8: it

    it("should create a boiler system", async () => {

        const context = SessionContext.defaultContext;

        const boilerType = createBoilerType(addressSpace);
        boilerType.getNotifiers().length.should.eql(3);
        boilerType.getEventSources().length.should.eql(1);

        const boiler = makeBoiler(addressSpace, {
            browseName: "Boiler#1",
            organizedBy: addressSpace.rootFolder
        });

        boiler.pipeX001.browseName.toString().should.eql("1:PipeX001");
        boiler.pipeX002.browseName.toString().should.eql("1:PipeX002");
        boiler.drumX001.browseName.toString().should.eql("1:DrumX001");
        boiler.simulation.browseName.toString().should.eql("1:Simulation");

        // xx boiler.pipeX001.displayName.text.toString().should.eql("Pipe1001");

        boiler.pipeX001.modellingRule!.should.eql("Mandatory");
        boiler.pipeX002.modellingRule!.should.eql("Mandatory");
        boiler.drumX001.modellingRule!.should.eql("Mandatory");
        boiler.simulation.modellingRule!.should.eql("Mandatory");

        boiler.getNotifiers().length.should.eql(3);
        boiler.getEventSources().length.should.eql(1);

        boiler.getNotifiers().map((x: BaseNode) => {
            return x.browseName.name!.toString();
        }).join(" ").should.eql("PipeX001 DrumX001 PipeX002");
        // xx boiler.pipeX001.notifierOf.nodeId.toString().should.eql(boiler.nodeId.toString());
        // xx boiler.pipeX001.notifierOf.nodeId.toString().should.eql(boiler.nodeId.toString());

        const haltMethod = boiler.simulation.getMethodByName("Halt")!;
        const resetMethod = boiler.simulation.getMethodByName("Reset")!;
        const startMethod = boiler.simulation.getMethodByName("Start")!;
        const suspendMethod = boiler.simulation.getMethodByName("Suspend")!;

        // expecting initial state to be Ready
        haltMethod.getExecutableFlag(context).should.eql(true);
        resetMethod.getExecutableFlag(context).should.eql(false);
        startMethod.getExecutableFlag(context).should.eql(true);
        suspendMethod.getExecutableFlag(context).should.eql(false);

        const callMethodResponse = await haltMethod.execute([], context);
        if (doDebug) {
            console.log(chalk.bgWhite.cyan(" Halt has been called"), callMethodResponse.statusCode!.toString());
        }
        haltMethod.getExecutableFlag(context).should.eql(false);
        resetMethod.getExecutableFlag(context).should.eql(true);
        startMethod.getExecutableFlag(context).should.eql(false);
        suspendMethod.getExecutableFlag(context).should.eql(false);

        const callMethodResponse1 = await resetMethod.execute([], context);
        if (doDebug) {
            console.log(chalk.bgWhite.cyan(" resetMethod has been called"), callMethodResponse1.statusCode!.toString());
        }
        haltMethod.getExecutableFlag(context).should.eql(true);
        resetMethod.getExecutableFlag(context).should.eql(false);
        startMethod.getExecutableFlag(context).should.eql(true);
        suspendMethod.getExecutableFlag(context).should.eql(false);

        const callMethodResponse2 = await startMethod.execute([], context);

        if (doDebug) {
            console.log(chalk.bgWhite.cyan(" startMethod has been called"), callMethodResponse2.statusCode!.toString());
        }
        haltMethod.getExecutableFlag(context).should.eql(true);
        resetMethod.getExecutableFlag(context).should.eql(true);
        startMethod.getExecutableFlag(context).should.eql(false);
        suspendMethod.getExecutableFlag(context).should.eql(true);

        const callMethodResponse3 = await suspendMethod.execute([], context);

        if (doDebug) {
            console.log(chalk.bgWhite.cyan("suspendMethod has been called"), callMethodResponse3.statusCode!.toString());
        }
        haltMethod.getExecutableFlag(context).should.eql(true);
        resetMethod.getExecutableFlag(context).should.eql(true);
        startMethod.getExecutableFlag(context).should.eql(true);
        suspendMethod.getExecutableFlag(context).should.eql(false);

    });
开发者ID:node-opcua,项目名称:node-opcua,代码行数:84,代码来源:test_boiler.ts


注:本文中的chalk.bgWhite类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。