UserScriptInjection constructor

UserScriptInjection({
  1. bool? injectImmediately,
  2. required List<ScriptSource> js,
  3. required InjectionTarget target,
  4. ExecutionWorld? world,
  5. String? worldId,
})

Implementation

UserScriptInjection({
  /// Whether the injection should be triggered in the target as soon as
  /// possible. Note that this is not a guarantee that injection will occur
  /// prior to page load, as the page may have already loaded by the time the
  /// script reaches the target.
  bool? injectImmediately,

  /// The list of ScriptSource objects defining sources of scripts to be
  /// injected into the target.
  required List<ScriptSource> js,

  /// Details specifying the target into which to inject the script.
  required InjectionTarget target,

  /// The JavaScript "world" 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.UserScriptInjection(
        injectImmediately: injectImmediately,
        js: js.toJSArray((e) => e.toJS),
        target: target.toJS,
        world: world?.toJS,
        worldId: worldId,
      );