Comments (2)
It sounds like you want to use the this
variable inside the handleRequest function to refer to teach
, check
, or match
, is that correct?
If so, then you would want to bind
the functions like this:
let teach = new (require('./teach').teach)(admin);
let actionMap = new Map();
actionMap.set(ACTION_LEARN, teach.handleRequest.bind(teach));
actionMap.set(ACTION_PRACTICE, check.handleRequest.bind(check));
actionMap.set(HANDLE_ANSWER, match.handleRequest.bind(match));
app.handleRequest(actionMap);
bind
will bind the this
variable to whatever you pass to it in the first argument of bind
Here's a reliable documentation on the usage of bind
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function/bind
Let me know if that's not what you mean
from actions-on-google-nodejs.
Appears to be working. Thanks!
from actions-on-google-nodejs.
Related Issues (20)
- Support configuring loggers HOT 1
- Sign homegraph request using IAM API HOT 2
- Link Out Suggestion not working as expected
- smarthome Action: onSync response is invalid (according to GCP logs explorer) HOT 1
- How to bypass middleware and only get JSON response HOT 1
- queryText being sent to Dialogflow is not the original user query HOT 4
- Response is malformed HOT 1
- Smart Home: Cache authorization tokens HOT 14
- Smart Home: Allow to set https agent options HOT 1
- Error, Entity not found
- TypeError: Cannot read property '0' of undefined HOT 1
- npm audit has been reporting vulnerabilities since at least October 2020, please can we update dependencies? HOT 7
- account link success but action response error
- onDisconnect bug
- unable to trigger actions.intent.NO_MATCH HOT 2
- Can't find user access token in requests to fulfilment webhooks HOT 1
- Upgrade "google-auth-library" dependency to latest major version
- TypeError: Cannot read properties of undefined (reading '0')
- Turtorial on authentication
- Typescript doesn't compile with `strictNullChecks: true`
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 actions-on-google-nodejs.