nostr-web-components
Version:
collection of web components that provide quick access to basic nostr things
3 lines (2 loc) • 902 B
JavaScript
var m=Object.defineProperty;var p=(s,t,e)=>t in s?m(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e;var o=(s,t,e)=>p(s,typeof t!="symbol"?t+"":t,e);import{bareNostrUser as u}from"@nostr/gadgets/metadata";import{i as b,f as c}from"./nostr.js";import{d as h}from"./utils.js";import{npubEncode as l}from"@nostr/tools/nip19";import"@nostr/tools/pool";import"@nostr/gadgets/lists";import"@nostr/gadgets/global";import"@nostr/tools/nip05";class r extends HTMLElement{constructor(){super();o(this,"set",h(async()=>{let e=this.getAttribute("pubkey");if(e){this.textContent=u(e).shortName;let[i,n]=await b(e);if(i){this.title=l(i);let a=await c(i,n||[]);this.textContent=a.shortName}}},200));this.set()}connectedCallback(){this.set()}attributeChangedCallback(){this.set()}}o(r,"observedAttributes",["pubkey"]);window.customElements.define("nostr-name",r);
//# sourceMappingURL=nostr-name.js.map