Comments (3)
just to clarify, is this
intended to refer to the execution context for the myRenderer
function? (ie. exactly as the js code is typed)
from js-interop.
Thanks a lot for the fast response and this very intuitive great library!!!
In my guess, this
here refers to Handsontable instance.
Refer to an example source: https://handsontable.com/docs/7.1.0/frameworks-wrapper-for-react-custom-renderer-example.html
Anyway, js apply
function oftentimes needs this
as its argument. I would like to know how I can deal with this situation.
from js-interop.
Maybe something like this:
(defn my-renderer [instance td row col prop value cellProperties]
(this-as this
(-> (j/get-in Handsontable [:renderers :TextRenderer])
(.call this instance td row col prop value cellProperties))))
The call-in
and apply-in
in js-interop are for the common case where you want to call a nested function, with this
bound to its immediate parent. In your case you need to first use this-as
to get the current function's this
, and then I'd use .call
instead of .apply
because we don't have a reliable way of accessing the arguments
array.
(There is also js-this
and js-arguments
but they can't be relied upon generally, they might not do what you expect depending on what the cljs compiler emits for the surrounding code)
from js-interop.
Related Issues (18)
- cljdoc build failing because release.clj seems to be included in jar HOT 1
- Destructuring macros HOT 1
- Support for CLJC HOT 1
- ClojureScript as provided dependency HOT 3
- consider using only project name in namespace HOT 4
- Destructuring nested array returns nil HOT 2
- Error getting length of a string HOT 1
- j/get-in macro v.s j/get-in function HOT 2
- Examples that show the Javascript equivalent HOT 2
- possible new feature: tagged literal, recursive version of #js
- get-in blows up when path does not exists HOT 5
- escaped " does not survive lit HOT 1
- js-delete feature request
- Bug in 2-arity `get-in`: Don't know how to create ISeq from: clojure.lang.Symbol when the keys are coming from a var
- Call a function in a nested key? HOT 10
- a shorter namespace for convenience? HOT 3
- compile error with `j/lit` and fn value HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from js-interop.