Skip to content

Commit bbc959f

Browse files
authored
Update README.md
1 parent 59d2121 commit bbc959f

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

README.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,21 @@ http://ryanmorr.com/using-mutation-observers-to-watch-for-element-availability/
5656

5757
Special thanks to [Ryan Morr](http://ryanmorr.com/)
5858

59+
## How do I inject large JavaScript
60+
61+
You can host the JS code in public accessible url and dynamically load and eval it. A sample implementation like this:
62+
63+
```
64+
customjsReady('body', function(element) {
65+
fetch('https://gist.githubusercontent.com/xcv58/5aaeda690ace2f468d51dbf9c65a3980/raw/a8b1c59223892fb2be08490b00c84fa4a029bb8e/test.js')
66+
.then((res) => res.text())
67+
.then((js) => {
68+
console.log('works in fetch', js)
69+
eval(js);
70+
})
71+
});
72+
```
73+
5974
# Why Custom JavaScript for Websites 2
6075
Since the author haven't update original extension for almost one year.
6176
Its website http://hromadadan.com is also unavailable.

0 commit comments

Comments
 (0)