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


TypeScript Log.warn函数代码示例

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


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

示例1: processStanza

   public processStanza(stanza: Element): boolean {
      let from = new JID($(stanza).attr('from'));
      let contact = this.account.getContact(from);

      if (!contact) {
         Log.warn('Got invitation from stranger. Ignore silently.');
      } else if (contact.getType() === 'groupchat') {
         Log.warn('I don\'t accept direct invitations from MUC rooms.');
      }

      let xElement = $(stanza).find('x[xmlns="jabber:x:conference"]');
      let roomJid = new JID(xElement.attr('jid'));
      let password = xElement.attr('password');
      let reason = xElement.attr('reason') || xElement.text(); //pidgin workaround

      this.account.getNoticeManager().addNotice({
         title: 'Invitation',
         description: `for ${roomJid.bare}`,
         type: NOTICETYPE.invitation,
         fnName: NOTICEFUNCTION.multiUserInvitation,
         fnParams: ['direct', from.bare, roomJid.bare, reason, password]
      });

      return this.PRESERVE_HANDLER;
   }
开发者ID:jsxc,项目名称:jsxc,代码行数:25,代码来源:DirectInvitation.ts

示例2: getDeviceProperties

async function getDeviceProperties(device: Device, identityManager: IdentityManager) {
   let trust = device.getTrust();
   let fingerprint: string;
   let showControls = !device.isCurrentDevice();

   try {
      fingerprint = await identityManager.loadFingerprint(device.getAddress());

      if (device.isDisabled()) {
         device.enable();
      }
   } catch (err) {
      Log.warn('Error while retrieving fingerprint', err);

      device.disable();

      trust = Trust.ignored;
      fingerprint = 'Not available';
      showControls = false;
   }

   return {
      id: device.getId(),
      isCurrentDevice: device.isCurrentDevice(),
      fingerprint,
      trust: Trust[trust],
      lastUsed: device.getLastUsed(),
      showControls
   };
};
开发者ID:jsxc,项目名称:jsxc,代码行数:30,代码来源:omemoDevices.ts

示例3: if

         return this.requestDiscoInfo(jid).then(discoInfo => {
            if (version && version !== discoInfo.getCapsVersion()) {
               Log.warn(`Caps version doesn't match for ${jid.full}. Expected: ${version}. Actual: ${discoInfo.getCapsVersion()}.`);
            } else if (!version) {
               this.addRelation(jid, discoInfo);
            }

            return discoInfo;
         });
开发者ID:jsxc,项目名称:jsxc,代码行数:9,代码来源:DiscoInfoRepository.ts

示例4:

      }).catch((reason) => {

         //@TODO hide user media request overlay

         //@TODO post reason to chat window
         if (reason !== 'aborted') {
            Log.warn('Decline call', reason)

            this.session.decline();
         }
      });
开发者ID:jsxc,项目名称:jsxc,代码行数:11,代码来源:JingleStreamSession.ts

示例5: deleteAllData

export function deleteAllData() {
   if (!Client.isDebugMode()) {
      Log.warn('This action is only available in debug mode.');

      return 0;
   }

   let storage = Client.getStorage();
   let prefix = storage.getPrefix();
   let prefixRegex = new RegExp('^' + prefix);
   let backend = storage.getBackend();
   let keys = Object.keys(backend);
   let count = 0;

   for (let key of keys) {
      if (prefixRegex.test(key) && key !== prefix + 'debug') {
         backend.removeItem(key);
         count++;
      }
   }

   return count;
}
开发者ID:jsxc,项目名称:jsxc,代码行数:23,代码来源:debug.ts

示例6: actionHandler

function actionHandler(deviceElement, actionElement, device: Device) {
   let action = actionElement.attr('data-action');

   if (action === 'verify') {
      device.setTrust(Trust.confirmed);
   } else if (action === 'recognize') {
      device.setTrust(Trust.recognized);
   } else if (action === 'ignore') {
      device.setTrust(Trust.ignored);
   } else {
      Log.warn('Unknown action');

      return;
   }

   let trustElement = deviceElement.find('.jsxc-omemo-device-trust');
   let trust = device.getTrust();
   let trustString = Trust[trust];

   trustElement.attr('data-trust', trustString);

   trustElement.text(trustString);
}
开发者ID:jsxc,项目名称:jsxc,代码行数:23,代码来源:omemoDevices.ts


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