Skip to content

Commit

Permalink
feat: expose IHeroExtractorCreateOptions interface
Browse files Browse the repository at this point in the history
  • Loading branch information
calebjclark committed Oct 11, 2022
1 parent 857d8f1 commit 60d4851
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 5 deletions.
2 changes: 2 additions & 0 deletions client/index.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ const {
LocationStatus,
LocationTrigger,
IHeroCreateOptions,
IHeroExtractorCreateOptions,
IConnectionToCoreOptions,
ISuperElement,
ISuperNode,
Expand Down Expand Up @@ -54,6 +55,7 @@ export {
LocationStatus,
LocationTrigger,
IHeroCreateOptions,
IHeroExtractorCreateOptions,
IConnectionToCoreOptions,
ISuperElement,
ISuperNode,
Expand Down
2 changes: 2 additions & 0 deletions client/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import { InteractionCommand, MouseButton, } from '@unblocked-web/specifications
import { Node, XPathResult } from '@ulixee/hero-interfaces/AwaitedDom';
import { LoadStatus, LocationStatus, LocationTrigger } from '@unblocked-web/specifications/agent/browser/Location';
import IHeroCreateOptions from './interfaces/IHeroCreateOptions';
import IHeroExtractorCreateOptions from './interfaces/IHeroExtractorCreateOptions';
import IConnectionToCoreOptions from './interfaces/IConnectionToCoreOptions';
import { Command } from './interfaces/IInteractions';
import { Hero, HeroExtractor, FrameEnvironment, Tab, Resource, WebsocketResource } from './lib/extendables';
Expand Down Expand Up @@ -51,6 +52,7 @@ export {
LocationStatus,
LocationTrigger,
IHeroCreateOptions,
IHeroExtractorCreateOptions,
IConnectionToCoreOptions,
ISuperElement,
ISuperNode,
Expand Down
7 changes: 7 additions & 0 deletions client/interfaces/IHeroExtractorCreateOptions.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import Hero from "../lib/Hero";
import IHeroCreateOptions from "./IHeroCreateOptions";

export default interface IHeroExtractorCreateOptions extends IHeroCreateOptions {
previousSessionId: string;
hero?: Hero;
}
11 changes: 6 additions & 5 deletions client/lib/HeroExtractor.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,19 @@
import Hero from "./Hero";
import IHeroCreateOptions from "../interfaces/IHeroCreateOptions";
import IHeroExtractorCreateOptions from "../interfaces/IHeroExtractorCreateOptions";
import CollectedElements from "./CollectedElements";
import CollectedResources from "./CollectedResources";
import CollectedSnippets from "./CollectedSnippets";

interface IHeroExtractorCreateOptions extends IHeroCreateOptions {
previousSessionId: string;
}

export default class HeroExtractor {
#hero: Hero;

constructor(initializeOptions: IHeroExtractorCreateOptions) {
this.#hero = new Hero(initializeOptions);
if (initializeOptions.hero) {
this.#hero = initializeOptions.hero
} else {
this.#hero = new Hero(initializeOptions);
}
}

public get collectedElements(): CollectedElements {
Expand Down

0 comments on commit 60d4851

Please sign in to comment.