status-im / pluto

https://status-im.github.io/pluto/
12 stars 3 forks source link

Access host defined functions #50

Closed janherich closed 6 years ago

janherich commented 6 years ago

Allow host defined functions to be specified as property type in hook.

jeluard commented 6 years ago

How is this different from event?

janherich commented 6 years ago

@jeluard Events are just keywords (:events key in capacities is set of keywords), while functions are mapping fn-symbol->fn-definition. Furthermore, the semantics is completely different, events can be referred in the components props of certain type (event handlers like :on-change, on-click etc.), where their dispatch is constructed with event arguments, functions can't and they are never called in the extensions, the only possibility is to pass them (function reference) back to the AppHook via prop. Events of type :set-in are also validated against permissions object.