當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。