• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

TypeScript util.callbackify函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: installPushCertificateManagement

export function installPushCertificateManagement(
  addressSpace: AddressSpace,
  options: PushCertificateManagerServerOptions
) {

    const serverConfiguration = addressSpace.rootFolder.objects.server.serverConfiguration;

    const serverConfigurationPriv = serverConfiguration as any;
    if (serverConfigurationPriv.$pushCertificateManager) {
       return;
       throw new Error("PushCertificateManagement has already been installed");
    }
    serverConfigurationPriv.$pushCertificateManager = new PushCertificateManagerServerImpl(options);

    serverConfiguration.supportedPrivateKeyFormats.setValueFromSource({
        arrayType: VariantArrayType.Array,
        dataType: DataType.String,
        value: ["PEM"]
    });

    serverConfiguration.createSigningRequest.bindMethod(callbackify(_createSigningRequest));

    serverConfiguration.updateCertificate.bindMethod(callbackify(_updateCertificate));

    serverConfiguration.getRejectedList.bindMethod(callbackify(_getRejectedList));

    if (serverConfiguration.applyChanges) {
        serverConfiguration.applyChanges!.bindMethod(callbackify(_applyChanges));
    }

    installCertificateExpirationAlarm(addressSpace);

}
开发者ID:node-opcua,项目名称:node-opcua,代码行数:33,代码来源:push_certificate_manager_helpers.ts


示例2: start

    public start(done: (err?: Error) => void): void {

        assert(!this.mDnsResponder);
        assert(_.isArray(this.capabilitiesForMDNS));

        callbackify(extractFullyQualifiedDomainName)((err1: Error | null, fqdn: string) => {

            if (this._delayInit) {
                this._delayInit();
                this._delayInit = undefined;
            }

            super.start((err?: Error | null) => {

                if (err) {
                    return done(err);
                }
                this.mDnsResponder = new MDNSResponder();
                // declare discovery server in bonjour
                this.bonjourHolder._announcedOnMulticastSubnetWithCallback({
                    capabilities: this.capabilitiesForMDNS,
                    name: this.serverInfo.applicationUri!,
                    path: "/DiscoveryServer",
                    port: this.endpoints[0].port
                }, (err2: Error | null) => {
                    done(err2!);
                });
            });
        });
    }
开发者ID:node-opcua,项目名称:node-opcua,代码行数:30,代码来源:opcua_discovery_server.ts


示例3: make_back_references

    }, (err?: Error | null) => {
        make_back_references(addressSpace1);

        // perform post task
        debugLog("Performing post loading tasks");

        async function performPostLoadingTasks(tasks: Task[]): Promise<void> {
            for (const task of tasks) {
                try {
                    await task(addressSpace1);
                }
                // istanbul ignore next
                catch (err) {
                    console.log(" Err  => ", err.message);
                    console.log(err);
                }
            }
        }

        callbackify(performPostLoadingTasks)(postTasks, () => {
            postTasks = [];
            debugLog("Post loading task done");
            assert(!addressSpace1.suspendBackReference);
            callback!(err || undefined);
        });

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


示例4: __createSession_step2

    /**
     *
     * @internal
     * @private
     */
    public __createSession_step2(
      session: ClientSessionImpl,
      callback: (err: Error | null, session?: ClientSessionImpl
      ) => void) {

        callbackify(extractFullyQualifiedDomainName)(() => {
            this.__createSession_step3(session, callback);
        });
    }
开发者ID:node-opcua,项目名称:node-opcua,代码行数:14,代码来源:opcua_client_impl.ts


示例5: test

        static test(): void {
            const cfn = util.callbackify(callbackifyTest.fn);
            const cfnE = util.callbackify(callbackifyTest.fnE);
            const cfnT1 = util.callbackify(callbackifyTest.fnT1);
            const cfnT1E = util.callbackify(callbackifyTest.fnT1E);
            const cfnTResult = util.callbackify(callbackifyTest.fnTResult);
            const cfnTResultE = util.callbackify(callbackifyTest.fnTResultE);
            const cfnT1TResult = util.callbackify(callbackifyTest.fnT1TResult);
            const cfnT1TResultE = util.callbackify(callbackifyTest.fnT1TResultE);

            cfn((err: NodeJS.ErrnoException | null, ...args: string[]) => assert(err === null && args.length === 1 && args[0] === undefined));
            cfnE((err: NodeJS.ErrnoException, ...args: string[]) => assert(err.message === 'fail' && args.length === 0));
            cfnT1('parameter', (err: NodeJS.ErrnoException | null, ...args: string[]) => assert(err === null && args.length === 1 && args[0] === undefined));
            cfnT1E('parameter', (err: NodeJS.ErrnoException, ...args: string[]) => assert(err.message === 'fail' && args.length === 0));
            cfnTResult((err: NodeJS.ErrnoException | null, ...args: string[]) => assert(err === null && args.length === 1 && args[0] === 'result'));
            cfnTResultE((err: NodeJS.ErrnoException, ...args: string[]) => assert(err.message === 'fail' && args.length === 0));
            cfnT1TResult('parameter', (err: NodeJS.ErrnoException | null, ...args: string[]) => assert(err === null && args.length === 1 && args[0] === 'result'));
            cfnT1TResultE('parameter', (err: NodeJS.ErrnoException, ...args: string[]) => assert(err.message === 'fail' && args.length === 0));
        }
开发者ID:TeamworkGuy2,项目名称:DefinitelyTyped,代码行数:19,代码来源:util.ts


示例6: callback

        if (this._service) {
            // due to a wrong declaration of Service.stop in the d.ts file we
            // need to use a workaround here
            const this_service = this._service as any as ServiceFixed;
            this._service = undefined;
            this._multicastDNS = undefined;
            this.announcement = undefined;
            const proxy = (callback: (err?: Error) => void)=>{
                this_service.stop(()=>{
                    callback();
                })
            };
            const stop = promisify(proxy);
            await stop.call(this);
            releaseBonjour();
            debugLog("stop announcement completed");
        }
    }

    public _stop_announcedOnMulticastSubnetWithCallback(
        callback: (err: Error | null) => void) {
        callback(new Error("Internal Error"));
    }

}

BonjourHolder.prototype._announcedOnMulticastSubnetWithCallback =
    callbackify(BonjourHolder.prototype._announcedOnMulticastSubnet);
BonjourHolder.prototype._stop_announcedOnMulticastSubnetWithCallback =
    callbackify(BonjourHolder.prototype._stop_announcedOnMulticastSubnet);
开发者ID:node-opcua,项目名称:node-opcua,代码行数:30,代码来源:bonjour.ts


示例7: assert

        // handle initial OpenSecureChannelRequest
        this._process_certificates(message, (err: Error | null, statusCode?: StatusCode) => {

            if (err) {
                description = "Internal Error " + err.message;
                return this._send_error(StatusCodes.BadInternalError, description, message, callback);
            }
            if (!statusCode) {
                assert(false);
            }
            if (statusCode !== StatusCodes.Good) {
                const description = "Sender Certificate Error";
                console.log(chalk.cyan(description), chalk.bgRed.yellow(statusCode!.toString()));
                // OPCUA specification v1.02 part 6 page 42 $6.7.4
                // If an error occurs after the  Server  has verified  Message  security  it  shall  return a  ServiceFault  instead
                // of a OpenSecureChannel  response. The  ServiceFault  Message  is described in  Part  4,   7.28.
                return this._send_error(statusCode!, "", message, callback);
            }

            this._handle_OpenSecureChannelRequest(message, callback);
        });
    }
}

import { ObjectRegistry } from "node-opcua-object-registry";

ServerSecureChannelLayer.registry = new ObjectRegistry({});

(ServerSecureChannelLayer as any).prototype.checkCertificateCallback =
  callbackify((ServerSecureChannelLayer as any).prototype.checkCertificate);
开发者ID:node-opcua,项目名称:node-opcua,代码行数:30,代码来源:server_secure_channel_layer.ts


示例8: RegisterServerXResponse

        const response = new RegisterServerXResponse({
            configurationResults
        });
        return response;
    }
}

/*== private
 * returns true if the serverType can be added to a discovery server.
 * @param serverType
 * @return {boolean}
 * @private
 */
function _isValidServerType(serverType: ApplicationType): boolean {

    switch (serverType) {
        case ApplicationType.Client:
            return false;
        case ApplicationType.Server:
        case ApplicationType.ClientAndServer:
        case ApplicationType.DiscoveryServer:
            return true;
    }
    return false;
}

(OPCUADiscoveryServer as any).prototype.__internalRegisterServerWithCallback =
  callbackify((OPCUADiscoveryServer as any).prototype.__internalRegisterServer);
exports.OPCUADiscoveryServer = OPCUADiscoveryServer;
开发者ID:node-opcua,项目名称:node-opcua,代码行数:29,代码来源:opcua_discovery_server.ts



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
TypeScript util.debuglog函数代码示例发布时间:2022-05-25
下一篇:
TypeScript utf8.encode函数代码示例发布时间:2022-05-25
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap