RegisteredContentScript constructor

RegisteredContentScript({
  1. required String id,
  2. List<String>? matches,
  3. List<String>? excludeMatches,
  4. List<String>? css,
  5. List<String>? js,
  6. bool? allFrames,
  7. bool? matchOriginAsFallback,
  8. RunAt? runAt,
  9. bool? persistAcrossSessions,
  10. ExecutionWorld? world,
})

Implementation

RegisteredContentScript({
  /// The id of the content script, specified in the API call. Must not start
  /// with a '_' as it's reserved as a prefix for generated script IDs.
  required String id,

  /// Specifies which pages this content script will be injected into. See
  /// [Match Patterns](develop/concepts/match-patterns) for more
  /// details on the syntax of these strings. Must be specified for
  /// [registerContentScripts].
  List<String>? matches,

  /// Excludes pages that this content script would otherwise be injected
  /// into.
  /// See [Match Patterns](develop/concepts/match-patterns) for
  /// more details on the syntax of these strings.
  List<String>? excludeMatches,

  /// The list of CSS files to be injected into matching pages. These are
  /// injected in the order they appear in this array, before any DOM is
  /// constructed or displayed for the page.
  List<String>? css,

  /// The list of JavaScript files to be injected into matching pages. These
  /// are injected in the order they appear in this array.
  List<String>? js,

  /// If specified true, it will inject into all frames, even if the frame is
  /// not the top-most frame in the tab. Each frame is checked independently
  /// for URL requirements; it will not inject into child frames if the URL
  /// requirements are not met. Defaults to false, meaning that only the top
  /// frame is matched.
  bool? allFrames,

  /// Indicates whether the script can be injected into frames where the URL
  /// contains an unsupported scheme; specifically: about:, data:, blob:, or
  /// filesystem:. In these cases, the URL's origin is checked to determine if
  /// the script should be injected. If the origin is `null` (as is the case
  /// for data: URLs) then the used origin is either the frame that created
  /// the current frame or the frame that initiated the navigation to this
  /// frame. Note that this may not be the parent frame.
  bool? matchOriginAsFallback,

  /// Specifies when JavaScript files are injected into the web page. The
  /// preferred and default value is `document_idle`.
  RunAt? runAt,

  /// Specifies if this content script will persist into future sessions. The
  /// default is true.
  bool? persistAcrossSessions,

  /// The JavaScript "world" to run the script in. Defaults to
  /// `ISOLATED`.
  ExecutionWorld? world,
}) : _wrapped = $js.RegisteredContentScript(
        id: id,
        matches: matches?.toJSArray((e) => e),
        excludeMatches: excludeMatches?.toJSArray((e) => e),
        css: css?.toJSArray((e) => e),
        js: js?.toJSArray((e) => e),
        allFrames: allFrames,
        matchOriginAsFallback: matchOriginAsFallback,
        runAt: runAt?.toJS,
        persistAcrossSessions: persistAcrossSessions,
        world: world?.toJS,
      );