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


TypeScript isfunction.default方法代码示例

本文整理汇总了TypeScript中lodash.isfunction.default方法的典型用法代码示例。如果您正苦于以下问题:TypeScript isfunction.default方法的具体用法?TypeScript isfunction.default怎么用?TypeScript isfunction.default使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在lodash.isfunction的用法示例。


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

示例1: module

 public module(argu?: any): any {
   switch (true) {
     case isUndefined(argu):
       return this.__getArray().map((node) => {
         node.props.getProp<IModule>("module");
       });
     case (isPlainObject(argu) || isFunction(argu)):
       const moduleManager = JThreeContext.getContextComponent<ModuleManager>(ContextComponents.ModuleManager);
       return this.__getArray().map((node) => {
         const moduleRegistry = moduleManager.addModule(argu);
         const moduleInstance = moduleRegistry.apply(node);
         moduleInstance.enabled = true;
         return moduleInstance;
       });
     default:
       throw new Error("Argument type is not correct");
   }
 }
开发者ID:kyasbal-1994,项目名称:jThree,代码行数:18,代码来源:Module.ts

示例2: on

 public on(argu0: any, argu1?: any, argu2?: any, argu3?: any): any {
   const eventData: IEventArgu = {
     events: {},
     data: null,
     selector: null,
   };
   let isEvents = false;
   const falseHandler: (eventObject: J3Event, ...extraParameter: any[]) => void = function(e) {
     e.preventDefault();
     e.stopPropagation();
   };
   switch (true) {
     case isString(argu0):
       eventData.events[argu0] = null;
       break;
     case isPlainObject(argu0):
       isEvents = true;
       eventData.events = argu0;
       break;
     default:
       throw new Error("Argument type is not correct");
   }
   switch (true) {
     case (isUndefined(argu1) && isEvents):
       break;
     case (isFunction(argu1) && !isEvents):
       eventData.events[argu0] = argu1;
       break;
     case (argu1 === false):
       eventData.events[argu1] = falseHandler;
       break;
     case isString(argu1):
       eventData.selector = argu1;
       switch (true) {
         case (isUndefined(argu2) && isEvents):
           break;
         case (isFunction(argu2) && !isEvents):
           eventData.events[argu0] = argu2;
           break;
         case (argu2 === false):
           eventData.events[argu2] = falseHandler;
           break;
         case isArray(argu2) || isPlainObject(argu2):
           eventData.data = argu2;
           switch (true) {
             case (isUndefined(argu3) && isEvents):
               break;
             case (isFunction(argu3) && !isEvents):
               eventData.events[argu0] = argu3;
               break;
             case (argu3 === false):
               eventData.events[argu3] = falseHandler;
               break;
             default:
               throw new Error("Argument type is not correct");
           }
           break;
         default:
           throw new Error("Argument type is not correct");
       }
       break;
     case isArray(argu1) || isPlainObject(argu1):
       eventData.data = argu1;
       switch (true) {
         case (isUndefined(argu2) && isEvents):
           break;
         case (isFunction(argu2) && !isEvents):
           eventData.events[argu0] = argu2;
           break;
         case (argu2 === false):
           eventData.events[argu2] = falseHandler;
           break;
         default:
           throw new Error("Argument type is not correct");
       }
       break;
     default:
       throw new Error("Argument type is not correct");
   }
   if (eventData.selector) {
     throw new Error("Not implemented yet");
   }
   Object.keys(eventData.events).forEach((eventTypeString) => {
     this.__getArray().forEach((node) => {
       let eventOrganizer = node.props.getProp<EventOrganizer>("event");
       if (!eventOrganizer) {
         eventOrganizer = new EventOrganizer(node);
         node.props.setProp("event", eventOrganizer);
       }
       eventOrganizer.capture(eventTypeString, eventData.events[eventTypeString], eventData.data);
     });
   });
   return this;
 }
开发者ID:kyasbal-1994,项目名称:jThree,代码行数:94,代码来源:EventHandlerAttachment.ts

示例3: off

 public off(argu0?: any, argu1?: any, argu2?: any): any {
   const eventData: IEventArgu = {
     events: {},
     data: null,
     selector: null,
   };
   let removeAll = false;
   let isEvents = false;
   switch (true) {
     case isUndefined(argu0):
       removeAll = true;
       break;
     case isString(argu0):
       eventData.events[argu0] = null;
       break;
     case isPlainObject(argu0):
       isEvents = true;
       eventData.events = argu0;
       break;
     default:
       throw new Error("Argument type is not correct");
   }
   switch (true) {
     case (removeAll):
     case (isUndefined(argu1) && isString(argu0)):
     case (isUndefined(argu1) && isEvents):
       break;
     case (isFunction(argu1) && !isEvents):
       eventData.events[argu0] = argu1;
       break;
     case isString(argu1):
       eventData.selector = argu1;
       switch (true) {
         case (isUndefined(argu2) && isEvents):
           break;
         case (isFunction(argu2) && !isEvents):
           eventData.events[argu0] = argu2;
           break;
         default:
           throw new Error("Argument type is not correct");
       }
       break;
     default:
       throw new Error("Argument type is not correct");
   }
   if (eventData.selector) {
     throw new Error("Not implemented yet");
   }
   if (removeAll) {
     this.__getArray().forEach((node) => {
       let eventOrganizer = node.props.getProp<EventOrganizer>("event");
       if (eventOrganizer) {
         eventOrganizer.releaseAll();
       }
     });
   } else {
     Object.keys(eventData.events).forEach((eventTypeString) => {
       this.__getArray().forEach((node) => {
         let eventOrganizer = node.props.getProp<EventOrganizer>("event");
         if (eventOrganizer) {
           if (eventData.events[eventTypeString]) {
             eventOrganizer.release(eventTypeString, eventData.events[eventTypeString]);
           } else {
             eventOrganizer.releaseAll(eventTypeString);
           }
         }
       });
     });
   }
 }
开发者ID:kyasbal-1994,项目名称:jThree,代码行数:70,代码来源:EventHandlerAttachment.ts

示例4: Error

 argu.reverse().forEach((argu_, i) => {
   if (i === 0 && isFunction(argu_)) {
     throw new Error("Not implemented yet");
   } else {
     const targets = this.__getArray();
     const contents = SomeToNode.convert(argu_, ["xmlstring", "node", "node[]", "j3obj", "j3obj[]"]);
     if (!contents) {
       throw new Error("Argument type is not correct");
     }
     NodeOperation.insert(targets, contents, () => 0);
   }
 });
开发者ID:kyasbal-1994,项目名称:jThree,代码行数:12,代码来源:NodeInsertionInside.ts

示例5: sendAck

  //todo: overload this function
  sendAck(timeoutMs: any, responsesRemaining?: any, cb?: any): void {
    if (!cb) {
      cb = last(arguments);
      if (!isFunction(cb)) cb = null;
      if (timeoutMs === cb) timeoutMs = null;
      if (responsesRemaining === cb) responsesRemaining = undefined;
    }

    this.ack.timeoutMs = (timeoutMs > -1) ? timeoutMs : this.ack.timeoutMs;
    if (isUndefined(responsesRemaining)) {
      this.ack.responsesRemaining = 1;
    } else {
      this.ack.responsesRemaining = responsesRemaining;
    }

    const ackMessage = messageFactory.createAckMessage(this.originalMessage, this.ack, this.config);

    this._sendMessage(ackMessage, cb);
  };
开发者ID:tcdl,项目名称:msb,代码行数:20,代码来源:responder.ts


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