本文整理汇总了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();
};
示例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);
}
};
示例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);
}
}
};
示例4: Game
ctrl.$onInit = (): void => {
ctrl.game = new Game();
ctrl.updateTimer = $interval(tickMethod, GameSettings.tick);
ctrl.fixedUpdateTimer = $interval(fixedTickMethod, 1000);
}
示例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);
}
});
//.........这里部分代码省略.........