Skip to content

Commit dbfbe21

Browse files
committed
Merge pull request #73 from joostliketoast/master
added explanation on how to use 'expose' to the read me file
2 parents 4204008 + c687681 commit dbfbe21

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

README.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -290,6 +290,22 @@ request.errback { |response|
290290
}
291291
```
292292

293+
## Usage of JQuery plugins
294+
Extra plugins used for JQuery aren't available to ruby code by default, you will have to `expose` these functions to opal-jquery.
295+
296+
```ruby
297+
Element.expose :cool_plugin
298+
```
299+
300+
Arguments to a `exposed` function will be passed as they are, so these arguments will have to be passed as native JS instead of ruby code. A conversion to native JS can be done with the `.to_n` method.
301+
302+
```ruby
303+
Element.expose :cool_plugin
304+
305+
el = Element['.html_element']
306+
el.cool_plugin({argument: 'value', argument1: 1000}.to_n)
307+
```
308+
293309
## License
294310

295311
(The MIT License)

0 commit comments

Comments
 (0)