create method

Object create(
  1. CreateProperties createProperties,
  2. JSFunction? callback
)

Creates a new context menu item. If an error occurs during creation, it may not be detected until the creation callback fires; details will be in runtime.lastError. callback Called when the item has been created in the browser. If an error occurs during creation, details will be available in runtime.lastError. returns The ID of the newly created item.

Implementation

Object create(
  CreateProperties createProperties,
  JSFunction? callback,
) {
  return $js.chrome.contextMenus
      .create(
        createProperties.toJS,
        callback,
      )
      .when(
        isInt: (v) => v,
        isString: (v) => v,
      );
}