proxy-handlers | Predefined ECMAScript 6 Proxy handlers | Proxy library
kandi X-RAY | proxy-handlers Summary
kandi X-RAY | proxy-handlers Summary
This library provides a number of subclassable ECMAScript 6 Proxy handlers. The goal is to simplify writing complete and correct Proxy handlers.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of proxy-handlers
proxy-handlers Key Features
proxy-handlers Examples and Code Snippets
Community Discussions
Trending Discussions on proxy-handlers
QUESTION
I'm searching for alternative ways to call a method defined in Marionette's behaviors from inside a view.
For sure there is the eventproxy but maybe it's more intuitive to call the method directly like:
...ANSWER
Answered 2017-Jan-04 at 07:59The answer to your question is you can not directly do so, but there is always a way.
you can do it using _.invoke(this._behaviors, 'yourMethodName')
but I will discourage using it
since
_behaviors is a private variable of the Marionette.View class and it's name can be changed or it can be dropped in upcoming versions
You will have to set context for the method as _.invoke will not set the context of the method to proper this.
if you can set the context properly then this will work for you.
as suggested by @ThePaxBisonica in comment I will suggest you to go with a mixin pattern from which you can extend both your behavior and view and you will not have to set any context and do not have to worry about the _behavior private variable
as
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install proxy-handlers
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page