Context.lookupObject(): Promise<Object | null>
Looks up an ActivityStreams object by its URI (including acct:
URIs)
or a fediverse handle (e.g., @user@server
or user@server
).
▶Example 1
Example 1
// Look up an actor by its fediverse handle: await ctx.lookupObject("@hongminhee@fosstodon.org"); // returning a `Person` object. // A fediverse handle can omit the leading '@': await ctx.lookupObject("hongminhee@fosstodon.org"); // returning a `Person` object. // A `acct:` URI can be used as well: await ctx.lookupObject("acct:hongminhee@fosstodon.org"); // returning a `Person` object. // Look up an object by its URI: await ctx.lookupObject("https://todon.eu/@hongminhee/112060633798771581"); // returning a `Note` object. // It can be a `URL` object as well: await ctx.lookupObject( new URL("https://todon.eu/@hongminhee/112060633798771581") ); // returning a `Note` object.
It's almost the same as the lookupObject function, but it uses the context's document loader and context loader by default.