mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-20 13:26:08 +00:00
Total document
This commit is contained in:
@@ -75,6 +75,7 @@ export class DeplomasService {
|
||||
}
|
||||
|
||||
saveDiplomasAssinadoList() {
|
||||
|
||||
setTimeout(()=>{
|
||||
localstoreService.set(this.keyNameDiplomasAssinado,{
|
||||
list: this._diplomasAssinadoList,
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
import { TestBed } from '@angular/core/testing';
|
||||
|
||||
import { TotalDocumentService } from './total-document.service';
|
||||
|
||||
describe('TotalDocumentService', () => {
|
||||
let service: TotalDocumentService;
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({});
|
||||
service = TestBed.inject(TotalDocumentService);
|
||||
});
|
||||
|
||||
it('should be created', () => {
|
||||
expect(service).toBeTruthy();
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,43 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { localstoreService } from './localstore.service'
|
||||
import { AES, enc, SHA1 } from 'crypto-js'
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
})
|
||||
export class TotalDocumentService {
|
||||
|
||||
private _count = 0
|
||||
// local storage keyName
|
||||
private keyName: string;
|
||||
|
||||
constructor() {
|
||||
this.keyName = (SHA1(this.constructor.name)).toString()
|
||||
|
||||
setTimeout(()=> {
|
||||
let restore = localstoreService.get(this.keyName, {})
|
||||
this._count = restore.count || 0
|
||||
}, 10)
|
||||
|
||||
}
|
||||
|
||||
get count() {
|
||||
return this._count
|
||||
}
|
||||
|
||||
resetCount(value) {
|
||||
this._count = value
|
||||
}
|
||||
|
||||
saveCount() {
|
||||
setTimeout(()=> {
|
||||
localstoreService.set(this.keyName, {
|
||||
count: this._count
|
||||
})
|
||||
}, 10)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
export let TotalDocumentStore = new TotalDocumentService()
|
||||
Reference in New Issue
Block a user