RegisteredUserScript constructor

RegisteredUserScript({
  1. bool? allFrames,
  2. List<String>? excludeMatches,
  3. required String id,
  4. List<String>? includeGlobs,
  5. List<String>? excludeGlobs,
  6. List<ScriptSource>? js,
  7. List<String>? matches,
  8. RunAt? runAt,
  9. ExecutionWorld? world,
  10. String? worldId,
})

Implementation

RegisteredUserScript({
  /// If 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,

  /// Excludes pages that this user 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 ID of the user script specified in the API call. This property must
  /// not start with a '_' as it's reserved as a prefix for generated script
  /// IDs.
  required String id,

  /// Specifies wildcard patterns for pages this user script will be injected
  /// into.
  List<String>? includeGlobs,

  /// Specifies wildcard patterns for pages this user script will NOT be
  /// injected into.
  List<String>? excludeGlobs,

  /// The list of ScriptSource objects defining sources of scripts to be
  /// injected into matching pages.
  /// This property must be specified for  ${ref:register}, and when specified
  /// it must be a non-empty array.
  List<ScriptSource>? js,

  /// Specifies which pages this user script will be injected into. See
  /// [Match Patterns](develop/concepts/match-patterns) for more
  /// details on the syntax of these strings. This property must be specified
  /// for
  /// ${ref:register}.
  List<String>? matches,

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

  /// The JavaScript execution environment to run the script in. The default
  /// is
  /// ``USER_SCRIPT``.
  ExecutionWorld? world,

  /// Specifies the user script world ID to execute in. If omitted, the script
  /// will execute in the default user script world. Only valid if `world` is
  /// omitted or is `USER_SCRIPT`. Values with leading underscores (`_`) are
  /// reserved.
  String? worldId,
}) : _wrapped = $js.RegisteredUserScript(
        allFrames: allFrames,
        excludeMatches: excludeMatches?.toJSArray((e) => e.toJS),
        id: id,
        includeGlobs: includeGlobs?.toJSArray((e) => e.toJS),
        excludeGlobs: excludeGlobs?.toJSArray((e) => e.toJS),
        js: js?.toJSArray((e) => e.toJS),
        matches: matches?.toJSArray((e) => e.toJS),
        runAt: runAt?.toJS,
        world: world?.toJS,
        worldId: worldId,
      );