browsertrix-crawler/tests/custom-behaviors/custom.js
Tessa Walsh 2a9b152531
Support loading custom behaviors from URLs and/or filepaths (#707)
Fixes #368 

The `--customBehaviors` flag is now an array, making it repeatable. This
should be backwards compatible with the CLI flag, but may require
changes to YAML configs when custom behaviors are used.

Custom behaviors can be loaded from URLs, local filepaths, and paths to
local directories, including any combination thereof.

New tests are added to ensure loading behaviors from URLs as well as a
mixed combination of URL and filepath works as expected.

---------

Co-authored-by: Ilya Kreymer <ikreymer@gmail.com>
2024-11-04 20:30:53 -08:00

21 lines
391 B
JavaScript

/* eslint-disable @typescript-eslint/no-unused-vars */
class TestBehavior {
static init() {
return {
state: {},
};
}
static get id() {
return "TestBehavior";
}
static isMatch() {
return window.location.origin === "https://specs.webrecorder.net";
}
async *run(ctx) {
ctx.log("In Test Behavior!");
yield ctx.Lib.getState(ctx, "test-stat");
}
}