ndn-js-contrib
Version:
Reusable 'Classes' for Named Data Networking: NameTree, PIT, FIB, ContentStore, Interfaces, and Transports
1 lines • 832 B
JavaScript
function repoEntry(a,b){var c=this,d=b.getMetaInfo?b.getMetaInfo().getFreshnessPeriod():null;return this.name=b.name,this.uri=b.name.toUri(),this.freshnessPeriod=d,this.publisherPublicKeyDigest=b.signedInfo?b.signedInfo.publisher.publisherPublicKeyDigest:void 0,d&&(this.element=a,setTimeout(function(){delete c.element},d)),this}repoEntry.installDatabase=function(a){repoEntry.database=a},repoEntry.type="repoEntry",repoEntry.prototype.getElement=function(a){this.element?a(this.element):repoEntry.database.getElement(this,a)},repoEntry.prototype.setElement=function(a){return this.freshnessPeriod&&(this.element=a,setTimeout(function(){delete this.element},this.freshnessPeriod)),this},repoEntry.prototype.stale=function(a){return a.repoEntry===this&&a.repoEntry.element&&delete a.repoEntry.element,this},module.exports=repoEntry;