Skip to content

Commit

Permalink
fix(rollup): update built format to UMD & fix usage info
Browse files Browse the repository at this point in the history
  • Loading branch information
brewcoua committed Jun 9, 2024
1 parent 6513a68 commit e027208
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
15 changes: 10 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,23 @@
# `web-som`
# `@brewcoua/web-som`

A Set-of-Marks script for web grounding, suitable for web agent automation.
When using this script, the web page should not have any animations or dynamic content that could interfere with the
script's operation.
script's operation. Additionally, since the script uses quite a few promises, it is recommended to avoid using too little
resources, as it could lead to a deadlock.

## Usage

Include both the script (`SoM.js` or `SoM.min.js`) and the style (`SoM.css` or `SoM.min.css`) in the web page.
You can then use the `SoM` object in the `window` object to interact with the script.
Include the script in your web page (`SoM.js` or `SoM.min.js`), and then call the `display` method on the `SoM` object in the `window` object.

### Example

```js
window.SoM.display().then(() => console.log('Set-of-Marks displayed'));
(async () => {
await window.SoM.display();
console.log('Set-of-Marks displayed');
const mark = window.SoM.resolve(4); // Resolve the fourth mark (with label '4')
mark.click(); // Click the mark
})();
```

### How it works
Expand Down
4 changes: 2 additions & 2 deletions rollup.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ export default {
output: [
{
file: 'dist/SoM.js',
format: 'cjs',
format: 'umd',
sourcemap: true,
},
{
file: 'dist/SoM.min.js',
format: 'cjs',
format: 'umd',
sourcemap: true,
plugins: [terser()],
},
Expand Down

0 comments on commit e027208

Please sign in to comment.