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


TypeScript IIntervalService.cancel方法代码示例

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


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

示例1: update

 function update() {
   const diff = vm.endTime.getTime() - Date.now();
   vm.text = dhms(diff / 1000);
   if (diff <= 0) {
     $interval.cancel(vm.timer);
   }
 }
开发者ID:bhollis,项目名称:DIM,代码行数:7,代码来源:countdown.component.ts

示例2: function

 vm.cancelRefreshUserTasks = function() {
   if (vm.tasksScheduler) {
     $interval.cancel(vm.tasksScheduler);
     vm.tasksScheduler = undefined;
   }
 };
开发者ID:gravitee-io,项目名称:gravitee-management-webui,代码行数:6,代码来源:navbar.component.ts

示例3: function

 vm.cancelRefreshUserNotifications = function() {
   if (vm.notificationsScheduler) {
     $interval.cancel(vm.notificationsScheduler);
     vm.notificationsScheduler = undefined;
   }
 };
开发者ID:gravitee-io,项目名称:gravitee-management-webui,代码行数:6,代码来源:portalnotifications.component.ts

示例4:

 vm.$onDestroy = () => {
   $interval.cancel(vm.timer);
 };
开发者ID:bhollis,项目名称:DIM,代码行数:3,代码来源:countdown.component.ts

示例5: D2FarmingService


//.........这里部分代码省略.........

      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);
          }
        });

        intervalId = $interval(() => {
          // just start reloading stores more often
          $rootScope.$broadcast('dim-refresh');
        }, 60000);
      }
    },

    stop() {
      if (intervalId) {
        $interval.cancel(intervalId);
      }
      if (subscription) {
        subscription.unsubscribe();
        subscription = null;
      }
      this.active = false;
      this.store = null;
    }
  };

  async function moveItemsToVault(store: DimStore, items: DimItem[], makeRoomBuckets: DimInventoryBucket[]) {
    const reservations = {};
    // reserve one space in the active character
    reservations[store.id] = {};
    makeRoomBuckets.forEach((bucket) => {
      reservations[store.id][bucket.type!] = 1;
    });

    for (const item of items) {
      try {
        // Move a single item. We reevaluate each time in case something changed.
        const vault = D2StoresService.getVault()!;
        const vaultSpaceLeft = vault.spaceLeftForItem(item);
        if (vaultSpaceLeft <= 1) {
          // If we're down to one space, try putting it on other characters
          const otherStores = D2StoresService.getStores().filter((s) => !s.isVault && s.id !== store.id);
          const otherStoresWithSpace = otherStores.filter((store) => store.spaceLeftForItem(item));

          if (otherStoresWithSpace.length) {
            if ($featureFlags.debugMoves) {
              console.log("Farming initiated move:", item.amount, item.name, item.type, 'to', otherStoresWithSpace[0].name, 'from', D2StoresService.getStore(item.owner)!.name);
            }
            await dimItemService.moveTo(item, otherStoresWithSpace[0], false, item.amount, items, reservations);
            continue;
          }
        }
        if ($featureFlags.debugMoves) {
          console.log("Farming initiated move:", item.amount, item.name, item.type, 'to', vault.name, 'from', D2StoresService.getStore(item.owner)!.name);
        }
        await dimItemService.moveTo(item, vault, false, item.amount, items, reservations);
      } catch (e) {
        if (e.code === 'no-space') {
          outOfSpaceWarning(store);
        } else {
          toaster.pop('error', item.name, e.message);
        }
        throw e;
      }
    }
  }
}
开发者ID:delphiactual,项目名称:DIM,代码行数:101,代码来源:d2farming.service.ts


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