Skip to content

Commit

Permalink
Fix #7, #11
Browse files Browse the repository at this point in the history
  • Loading branch information
rakina committed Mar 13, 2018
1 parent 852227c commit 0cbe46d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,3 +71,8 @@ Some examples:
Other than suppressing the browser's Find UI, there are some cases that we want to propose solutions for, such as making the browser wait for loading of data before proceeding a find action or adding to the browser's list of find results. As these cases are more complicated, we are making a separate document for those cases [here](explainer-extended.md).



## Related technologies
### window.find()
`window.find()` is a non-standard API used to search a certain string in the current window. It can't be used to communicate with / suppress browser's Find-in-page, so it is entirely different from the API we are proposing in this explainer.

6 changes: 3 additions & 3 deletions explainer-extended.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ window.addEventListener("findinginpage", e => {
estimatedScrollPosition: 90 // out of 100??
});

e.setDeferredResults([offScreenResult]);
e.addResults([offScreenResult]);
});

// Notify browser to redo last find-in-page query when new data is loaded
Expand Down Expand Up @@ -71,13 +71,13 @@ Additionally it may also have the attributes `caseSensitive` and `wholeWordsOnly

### Allow web page to send find results to browser

Additional methods on `findinginpage` event: `setDeferredResultsBeforeFirst(findResults)` and `setDeferredResultsAfterLast(findResults)`, where `findResults` is an array of `FindInPageResult`s.
Additional method on `findinginpage` event: `addResults(findResults)`, where `findResults` is an array of `FindInPageResult`s.

`FindInPageResult` have these attributes:
* `callback`: the function to be called when we want to show this result (when the user calls find prev/next until it reaches this find result)
* `estimatedScrollPosition`: the estimated scroll position of where the result is in the page

Calling `setDeferredResults{BeforeFirst,AfterLast}` with a list of `FindInPageResult`s will add them to the browser’s find-in-page results, before the first result and after the last result, respectively. When the find result needs to be shown, `callback` is called.
Calling `addResults` with a list of `FindInPageResult`s will add them to the browser’s find-in-page results, before the first result and after the last result, respectively. When the find result needs to be shown, `callback` is called.

### Allow web page to notify browser that new content has been loaded/modified

Expand Down

0 comments on commit 0cbe46d

Please sign in to comment.