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


TypeScript IIntervalService.default方法代码示例

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


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

示例1: Date

  vm.$onInit = () => {
    vm.endTime = new Date(vm.endTime);

    // Update once a minute
    vm.timer = $interval(update, 60000);
    update();
  };
开发者ID:bhollis,项目名称:DIM,代码行数:7,代码来源:countdown.component.ts

示例2:

 vm.$onInit = () => {
   this.lastNbNotification = -1;
   // schedule an automatic refresh of the user notifications
   if (!vm.notificationsScheduler) {
     vm.refreshUserNotifications();
     vm.notificationsScheduler = $interval(() => {
       vm.refreshUserNotifications();
     }, UserNotificationService.getNotificationSchedulerInSeconds() * 1000);
   }
 };
开发者ID:gravitee-io,项目名称:gravitee-management-webui,代码行数:10,代码来源:portalnotifications.component.ts

示例3: function

 vm.startTasks = function(user) {
   if (user.authenticated) {
     vm.graviteeUser = user;
     // schedule an automatic refresh of the user tasks
     if (!vm.tasksScheduler) {
       vm.refreshUserTasks();
       vm.tasksScheduler = $interval(() => {
         vm.refreshUserTasks();
       }, TaskService.getTaskSchedulerInSeconds() * 1000);
     }
   }
 };
开发者ID:gravitee-io,项目名称:gravitee-management-webui,代码行数:12,代码来源:navbar.component.ts

示例4: Game

 ctrl.$onInit = (): void => {
   ctrl.game = new Game();
   ctrl.updateTimer = $interval(tickMethod, GameSettings.tick);
   ctrl.fixedUpdateTimer = $interval(fixedTickMethod, 1000);
 }
开发者ID:jkachurek,项目名称:jkachurek.github.io,代码行数:5,代码来源:app.ts

示例5: getMakeRoomBuckets

export function D2FarmingService(
  $rootScope: IRootScopeService,
  $q: IQService,
  dimItemService: ItemServiceType,
  D2StoresService: StoreServiceType,
  $interval: IIntervalService,
  toaster,
  $i18next
) {
  'ngInject';

  let intervalId;
  let subscription;

  const outOfSpaceWarning = _.throttle((store) => {
    toaster.pop('info',
                $i18next.t('FarmingMode.OutOfRoomTitle'),
                $i18next.t('FarmingMode.OutOfRoom', { character: store.name }));
  }, 60000);

  function getMakeRoomBuckets() {
    return getBuckets().then((buckets) => {
      return Object.values(buckets.byHash).filter((b) => b.category === 3 && b.type);
    });
  }

  return {
    active: false,
    store: null,
    movingItems: false,
    makingRoom: false,

    // Ensure that there's one open space in each category that could
    // hold an item, so they don't go to the postmaster.
    async makeRoomForItems(store: DimStore) {
      const makeRoomBuckets = await getMakeRoomBuckets();

      // If any category is full, we'll move one aside
      let itemsToMove: DimItem[] = [];
      makeRoomBuckets.forEach((makeRoomBucket) => {
        const items = store.buckets[makeRoomBucket.id];
        if (items.length > 0 && items.length >= makeRoomBucket.capacity) {
          // We'll move the lowest-value item to the vault.
          const itemToMove = _.min(items.filter((i) => !i.equipped && !i.notransfer), (i) => {
            let value = {
              Common: 0,
              Uncommon: 1,
              Rare: 2,
              Legendary: 3,
              Exotic: 4
            }[i.tier];
            // And low-stat
            if (i.primStat) {
              value += i.primStat.value / 1000;
            }
            return value;
          });
          if (!_.isNumber(itemToMove)) {
            itemsToMove.push(itemToMove);
          }
        }
      });

      if (settings.farming.moveTokens) {
        itemsToMove = itemsToMove.concat(store.items.filter((i) => REP_TOKENS.has(i.hash)));
      }

      if (itemsToMove.length === 0) {
        return $q.resolve();
      }

      return moveItemsToVault(store, itemsToMove, makeRoomBuckets);
    },

    async farm(store: DimStore) {
      this.makingRoom = true;
      try {
        // Then make room for items
        await this.makeRoomForItems(store);
      } finally {
        this.makingRoom = false;
      }
    },

    start(account: DestinyAccount, storeId: string) {
      if (!this.active) {
        this.active = true;
        this.movingItems = false;
        this.makingRoom = false;

        // Whenever the store is reloaded, run the farming algo
        // That way folks can reload manually too
        subscription = D2StoresService.getStoresStream(account).subscribe((stores) => {
          // prevent some recursion...
          if (this.active && !this.movingItems && !this.makingRoom && stores) {
            const store = stores.find((s) => s.id === storeId);
            this.store = store;
            this.farm(store);
          }
        });
//.........这里部分代码省略.........
开发者ID:delphiactual,项目名称:DIM,代码行数:101,代码来源:d2farming.service.ts


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