Hello,
-- I am very newbie at smalltalk, amber, helios, etc, so please bear with me. I followed the directions at getting-started and everything went surprisingly well. So I got a bit ambitious and tried to load an external javascript library (pathjs). I did that, I can see its methods in the class browser and call all its functions that have one or more arguments. But I don't know how to call a javascript function with no arguments - presumably the simplest case! I tried this: Path listen value but I get a "type error: object is not a function" on "listen" and I'm stuck. Can you please help me out? Thanks in advance Alexis You received this message because you are subscribed to the Google Groups "amber-lang" group. To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email]. For more options, visit https://groups.google.com/d/optout. |
Path listen
Alexis Argyris <[hidden email]>napísal/a: Hello,
-- I am very newbie at smalltalk, amber, helios, etc, so please bear with me. I followed the directions at getting-started and everything went surprisingly well. So I got a bit ambitious and tried to load an external javascript library (pathjs). I did that, I can see its methods in the class browser and call all its functions that have one or more arguments. But I don't know how to call a javascript function with no arguments - presumably the simplest case! I tried this: Path listen value but I get a "type error: object is not a function" on "listen" and I'm stuck. Can you please help me out? Thanks in advance Alexis You received this message because you are subscribed to the Google Groups "amber-lang" group. To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email]. For more options, visit https://groups.google.com/d/optout. -- You received this message because you are subscribed to the Google Groups "amber-lang" group. To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email]. For more options, visit https://groups.google.com/d/optout. |
thanks a lot for the reply, actually i tried that too, what i got is: "type error object is not a function" on "listen".
-- any other ideas? On Thursday, January 29, 2015 at 9:46:29 AM UTC+2, Herby wrote: Path listen You received this message because you are subscribed to the Google Groups "amber-lang" group. To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email]. For more options, visit https://groups.google.com/d/optout. |
let me give you some more infor to potentially save time. here is what i've tried: Path map: '#/home' to: [ self goHome ]. Path map: '#/about' to: [ self goAbout ]. Path root: '#/home'. Path listen I get an error at last line Thanks On Thursday, January 29, 2015 at 10:34:49 AM UTC+2, Alexis Argyris wrote:
You received this message because you are subscribed to the Google Groups "amber-lang" group. To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email]. For more options, visit https://groups.google.com/d/optout. |
In reply to this post by Alexis Argyris
Alexis Argyris wrote: > thanks a lot for the reply, actually i tried that too, what i got is: > "type error object is not a function" on "listen". > > any other ideas? No "other ideas". It _is_ Path listen. In case that typeof Path.listen === "function", of course, and you want to call Path.listen(). If not, than I don't know what you wanted. To read more on how to use JavaScript from Amber, there is a dedicated wiki page for that in github amber repository. Getting "type error object is not a function" when evaluating `Path listen` is very strange, though. There is no reason why that error should appear there (Either listen is a function and is called, or it is an object, and then it is returned - or, the Path.listen() actually gets called, but the error happens inside of it - do you use Path.listen() call correctly? Isn't it trying to "call" something inside which happens to be an object?) Investigate what is there in (JS) Path.listen and if it does not throw the same exception to you when you call it from JS console as `Path.listen()` (in which case, Amber is proven non-guilty; calling Path.listen() itself is). Herby -- You received this message because you are subscribed to the Google Groups "amber-lang" group. To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email]. For more options, visit https://groups.google.com/d/optout. |
A brief look at pathjs leads me to think that you should try (Path map: '#/home') to: [ self goHome ]. (Path map: '#/about') to: [ self goAbout ]. Path root: '#/home'. Path listen -------------- Path map: '#/home' to: [ self goHome ]. translates to javascript as Path.map('#/home', function() { .....}) and you want to do Path.map('#/home').to(function () {.....}) On 29 January 2015 at 11:15, Herby Vojčík <[hidden email]> wrote:
You received this message because you are subscribed to the Google Groups "amber-lang" group. To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email]. For more options, visit https://groups.google.com/d/optout. |
Ryan Simmons wrote: > A brief look at pathjs leads me to think that you should try > > (Path map: '#/home') to: [ self goHome ]. > (Path map: '#/about') to: [ self goAbout ]. > Path root: '#/home'. > Path listen > -------------- > > Path map: '#/home' to: [ self goHome ]. translates to javascript as > Path.map('#/home', function() { .....}) and you want to do > Path.map('#/home').to(function () {.....}) That can explain the "object is not a function" when listen assumes function was mapped but it in fact was not. > On 29 January 2015 at 11:15, Herby Vojčík <[hidden email] > <mailto:[hidden email]>> wrote: > > > > Alexis Argyris wrote: > > thanks a lot for the reply, actually i tried that too, what i > got is: > "type error object is not a function" on "listen". > > any other ideas? > > > No "other ideas". It _is_ Path listen. In case that typeof > Path.listen === "function", of course, and you want to call > Path.li > more on how to use JavaScript from Amber, there is a dedicated > wiki page for that in github amber repository. > > Getting "type error object is not a function" when evaluating > `Path listen` is very strange, though. There is no reason why that > error should appear there (Either listen is a function and is > called, or it is an object, and then it is returned - or, the > Path.listen() actually gets called, but the error happens inside > of it - do you use Path.listen() call correctly? Isn't it trying > to "call" something inside which happens to be an object?) > > Investigate what is there in (JS) Path.listen and if it does not > throw the same exception to you when you call it from JS console > as `Path.listen()` (in which case, Amber is proven non-guilty; > calling Path.listen() itself is). > > Herby > > > -- > You received this message because yo > Groups "amber-lang" group. > To unsubscribe from this group and stop receiving emails from it, > send an email to [hidden email] > <mailto:amber-lang%[hidden email]>. > For more options, visit https://groups.google.com/d/__optout > <https://groups.google.com/d/optout>. > > > -- > You received this message because you are subscribed to the Google > Groups "amber-lang" group. > To unsubscribe from this group and stop receiving emails from it, send > an email to [hidden email] > <mailto:[hidden email]>. > For more options, visit https://groups.google.com/d/optout. -- You received this message because you are subscribed to the Google Groups "amber-lang" group. To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email]. For more options, visit https://groups.google.com/d/optout. |
In reply to this post by Alexis Argyris
Welcome Alexis! Thanks for the feedback on getting started, we are working on documentation and I was wondering if that one was updated. Regarding to routing, you can take a look at how flow uses rlite, a 1kb routing library: Also, to get you unstuck on some situations, remember that you can inline javascript in any object method like this: MyObject>>doThisWithJS <console.log(self)> from mobile
You received this message because you are subscribed to the Google Groups "amber-lang" group. To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email]. For more options, visit https://groups.google.com/d/optout. |
Hi Seb,
-- FYI, from my experience it is possible for a complete novice to successfully install the environment and start playing around with the examples just by following through the documentation available. To make things better you don't need to write any more material (at least not as a first priority). Just review the already existing text, hide all information about previous versions in an obscure link or something and leave visible prominently only information regarding the current version. This was my only difficulty. I was not aware of rlite, I will most certainly have a look. I will keep in mind the inline trick. Still, my question remains: why "Path listen" (or "Path listen value") fail? It should be a trivial call. Calling other methods (functions with arguments) of the same library works with no problem. Alexis On Thursday, January 29, 2015 at 1:12:26 PM UTC+2, Sebastian Sastre wrote:
You received this message because you are subscribed to the Google Groups "amber-lang" group. To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email]. For more options, visit https://groups.google.com/d/optout. |
Cool!
We are about to publish a how to create, publish and use libraries made with Amber (for Amber) so people start creating an Amber ecosystem of handy and cool things around it. For the team, PR here: Also you might want to take a look at: I’m upgrading it today
You received this message because you are subscribed to the Google Groups "amber-lang" group. To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email]. For more options, visit https://groups.google.com/d/optout. |
In reply to this post by Herby Vojčík
Ryan & Herby,
-- Thanks a lot for your efforts. I was not aware of what Ryan pointed out and it seems a good explanation of why I was getting that error. I switched to rlite as Seb suggested and it worked immediately (probably because I copy/pasted Seb's detailed example...) Thanks a lot for your help Alexis On Thursday, January 29, 2015 at 12:23:48 PM UTC+2, Herby wrote:
You received this message because you are subscribed to the Google Groups "amber-lang" group. To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email]. For more options, visit https://groups.google.com/d/optout. |
Free forum by Nabble | Edit this page |