Inheritance / inclusion in JS files #627
Unanswered
espruino-discuss
asked this question in
JavaScript
Replies: 2 comments
-
Posted at 2016-09-27 by @gfwilliams In your module, you haven't exported anything - so the result of including it will be an empty object. Do:
And then you should be off to a better start. However first, I'd make life simple for yourself by trying it all in one file. |
Beta Was this translation helpful? Give feedback.
0 replies
-
Posted at 2016-09-27 by Injecteer Thanks, the exports did the trick! |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Posted at 2016-09-27 by Injecteer
I tried to follow the Example , but in Espruino IDE it didn't really work.
I tried the following:
module moq_base.js
and then "inherit":
but it resulted in exceptions like
I tried also to define a plain function inside the "base" module and then call it, but it also fails - function not found.
So, are there any examples / tutorials on using JS-inheritance / inlcusion for ESP?
Or, it shouldn't be used and copy & paste is my only true friend?
Thanks!
Beta Was this translation helpful? Give feedback.
All reactions