UpdateProperties constructor

UpdateProperties({
  1. ItemType? type,
  2. String? title,
  3. bool? checked,
  4. List<ContextType>? contexts,
  5. bool? visible,
  6. JSFunction? onclick,
  7. Object? parentId,
  8. List<String>? documentUrlPatterns,
  9. List<String>? targetUrlPatterns,
  10. bool? enabled,
})

Implementation

UpdateProperties({
  ItemType? type,
  String? title,
  bool? checked,
  List<ContextType>? contexts,

  /// Whether the item is visible in the menu.
  bool? visible,
  JSFunction? onclick,

  /// The ID of the item to be made this item's parent. Note: You cannot set
  /// an item to become a child of its own descendant.
  Object? parentId,
  List<String>? documentUrlPatterns,
  List<String>? targetUrlPatterns,
  bool? enabled,
}) : _wrapped = $js.UpdateProperties(
        type: type?.toJS,
        title: title,
        checked: checked,
        contexts: contexts?.toJSArray((e) => e.toJS),
        visible: visible,
        onclick: onclick,
        parentId: switch (parentId) {
          int() => parentId.jsify()!,
          String() => parentId.jsify()!,
          null => null,
          _ => throw UnsupportedError(
              'Received type: ${parentId.runtimeType}. Supported types are: int, String')
        },
        documentUrlPatterns: documentUrlPatterns?.toJSArray((e) => e),
        targetUrlPatterns: targetUrlPatterns?.toJSArray((e) => e),
        enabled: enabled,
      );