本文整理汇总了TypeScript中@eg/core/store.service.StoreService类的典型用法代码示例。如果您正苦于以下问题:TypeScript service.StoreService类的具体用法?TypeScript service.StoreService怎么用?TypeScript service.StoreService使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了service.StoreService类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: ngOnInit
ngOnInit() {
this.searchContext = this.staffCat.searchContext;
this.defaultTab =
this.store.getLocalItem('eg.cat.default_record_tab')
|| 'catalog';
// Watch for URL record ID changes
// This includes the initial route.
// When applying the default configured tab, no navigation occurs
// to apply the tab name to the URL, it displays as the default.
// This is done so no intermediate redirect is required, which
// messes with browser back/forward navigation.
this.route.paramMap.subscribe((params: ParamMap) => {
this.recordTab = params.get('tab');
this.recordId = +params.get('id');
this.searchContext = this.staffCat.searchContext;
if (!this.recordTab) {
this.recordTab = this.defaultTab || 'catalog';
}
this.loadRecord();
});
}
示例2: open
async open(args: NgbModalOptions): Promise<boolean> {
this.holdIds = [].concat(this.holdIds); // array-ify ints
this.transferTarget =
this.store.getLocalItem('eg.circ.hold.title_transfer_target');
if (!this.transferTarget) {
this.toast.warning(await this.targetNeeded.current());
return Promise.reject('Transfer Target Required');
}
return super.open(args);
}
示例3: reprintLast
reprintLast() {
const prev = this.store.getLocalItem('eg.print.last_printed');
if (prev) {
const req: PrintRequest = {
text: prev.content,
printContext: prev.context || 'default',
contentType: prev.content_type || 'text/html',
showDialog: Boolean(prev.show_dialog)
};
this.print(req);
}
}
示例4: getRecordIds
// TODO: Add server-side API for sorting a set of bibs by ID.
// See EGCatLoader/Container::fetch_mylist
getRecordIds(): Promise<number[]> {
const cacheKey = this.store.getLoginSessionItem(BASKET_CACHE_KEY_COOKIE);
this.idList = [];
if (!cacheKey) { return Promise.resolve(this.idList); }
return this.anonCache.getItem(cacheKey, BASKET_CACHE_ATTR).then(
list => {
if (!list) { return this.idList; }
this.idList = list.map(id => Number(id));
return this.idList;
}
);
}
示例5: setRecordIds
setRecordIds(ids: number[]): Promise<number[]> {
this.idList = ids;
// If we have no cache key, that's OK, assume this is the first
// attempt at adding a value and let the server create the cache
// key for us, then store the value in our cookie.
const cacheKey = this.store.getLoginSessionItem(BASKET_CACHE_KEY_COOKIE);
return this.anonCache.setItem(cacheKey, BASKET_CACHE_ATTR, this.idList)
.then(key => {
this.store.setLoginSessionItem(BASKET_CACHE_KEY_COOKIE, key);
this.onChange.emit(this.idList);
return this.idList;
});
}
示例6: dispatchPrint
dispatchPrint(printReq: PrintRequest) {
if (!printReq.text) {
// Sometimes the results come from an externally-parsed HTML
// template, other times they come from an in-page template.
printReq.text = this.elm.nativeElement.innerHTML;
}
// Retain a copy of each printed document in localStorage
// so it may be reprinted.
this.store.setLocalItem('eg.print.last_printed', {
content: printReq.text,
context: printReq.printContext,
content_type: printReq.contentType,
show_dialog: printReq.showDialog
});
if (this.useHatch()) {
this.printViaHatch(printReq);
} else {
// Here the needed HTML is already in the page.
window.print();
}
}
示例7: useHatch
useHatch(): boolean {
return this.store.getLocalItem('eg.hatch.enable.printing')
&& this.hatch.connect();
}
示例8:
.then(key => {
this.store.setLoginSessionItem(BASKET_CACHE_KEY_COOKIE, key);
this.onChange.emit(this.idList);
return this.idList;
});
示例9: setDefaultTab
setDefaultTab() {
this.defaultTab = this.recordTab;
this.store.setLocalItem('eg.cat.default_record_tab', this.recordTab);
}