Skip to content

Commit c30ef03

Browse files
author
ben
committed
more notes
1 parent 80b9b0d commit c30ef03

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

README.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,23 @@ lightboxWidth | number | 1024 | Optional. Maximum width of th
126126

127127
* If you don't know your `thumbnailWidth` and `thumbnailHeight` values, you can find these out using any number of [javascript hacks](http://stackoverflow.com/a/1944298), bearing in mind the load penalty associated with these methods.
128128

129+
* User defined functions that allow access to `this` via [Function.prototype.call()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function/call) do not require you to pass `this` as a parameter. `this` will be defined at the time the function is called.
130+
131+
e.g.
132+
```js
133+
//somewhere in your code...
134+
function myTileViewportStyleFn() {
135+
if (this.props.item.isSelected)
136+
return {
137+
//some awesome style
138+
};
139+
}
140+
141+
//internally, within the react-grid-gallery component it will be called like so:
142+
myTileViewportStyleFn.call(this);
143+
144+
```
145+
129146

130147
### License
131148
React Grid Gallery is free to use for personal and commercial projects under the [MIT License](https://github.com/benhowell/react-grid-gallery/blob/master/LICENSE). Attribution is not required, but appreciated.

0 commit comments

Comments
 (0)