Yep, I asked if such instrument is exists. You have JS file in input, in output you have ST file. I don`t know if such instrument is necessary, but sometimes it will be very helpful.
воскресенье, 14 апреля 2013 г., 12:35:17 UTC+4 пользователь Manfred Kröhnert написал: -- 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/groups/opt_out. |
Well, I don't know of one, and I doubt it will exist. It would, as I see it, defeat the amber's view which is "if it already exists in JS, use it as-is" (not everything is possible easily, like AngularJS and its scopes built on prototype inheritance, but many does).
I understand you are probably rewriting existing source from JS to ST to work with it in ST afterwards, but this is not the case very often, imo. XumuK wrote: > Yep, I asked if such instrument is exists. You have JS file in input, > in output you have ST file. I don`t know if such instrument is > necessary, but sometimes it will be very helpful. > > воскресенье, 14 апреля 2013 г., 12:35:17 UTC+4 пользователь Manfred > Kröhnert написал: > > Hello Xumuk, > > sorry for popping in late. > From looking at the thread your main issue was to understand the > JS code and how to transform it into an Amber equivalent > structure, right? > > Best, > Manfre > > > > On Thu, Apr 11, 2013 at 8:50 AM, XumuK <[hidden email] > <javascript:>> wrote: > > Also there is an error in mouseHandler class. > In function > /getMousePositionForEvent: event/ > /....../ > /mousePosition := arbor Point: (event pageX - pos left) y: > (event pageY - pos top)./ > /mousePosition := NativeFunction constructor: 'arbor.Point' > value: (event pageX - pos left) value: (event pageY - pos top)./ > /....../ > > Thanks. > > среда, 10 апреля 2013 г., 15:01:09 UTC+4 пользователь XumuK > написал: > > Here it must be changed to ( sys asJQuery ) attr: > 'renderer' set: ( (ArbourRenderer newWithCanvas: > '#viewport' ) jsInterface ) > because of sys object don`t have a renderer field. > > среда, 10 апреля 2013 г., 0:58:55 UTC+4 пользователь Ryan > > > Here is an attempt at converting the "Renderer" object > from the file main.js that you attached earlier. I > have not tested this though hopefully it leads you in > the right direction. > > > the js line to create the renderer > sys.renderer = Renderer("#viewport"). > would be changed to > sys renderer: (ArbourRenderer newWithCanvas: > '#viewport' ) jsInterface > > > > On 9 April 2013 21:20, Ryan Simmons > <[hidden email]> wrote: > > You are right, I assumed he just wanted to pass > some data to another js library. > Sorry > > > On 9 April 2013 21:10, Apostolis Xekoukoulotakis > <[hidden email]> wrote: > > Excuse my ignorance, but i > describes the javascript equivalent of > defining methods for an object which should be > replaced with the definition of methods in the > smalltalk way? > > > 2013/4/9 Ryan Simmons <[hidden email]> > > a := #{ > 'first' -> [:parameter | ]. > 'second' -> [] > } > > > On 9 April 2013 20:53, XumuK > <[hidden email]> wrote: > > Not solved... > > How can I write > > /var a = { > first: function(parameter){ > } > second: function() { > } > > > in Amber? Please, help me to understand... > > пятница, 5 апреля 2013 г., 15:55:04 > UTC+4 пользователь XumuK написал: > > Solved. Sorry for my stupid > questions...)) > > пятница, 5 апреля 2013 г., > 15:31:17 UTC+4 пользователь XumuK > написал: > > Found more simple example: > > var o = { > test: 5, > bla: true > } > > How to interpret this? > > > /obj := (Object new) test: 5; > bla: true. > / > > Doesn`t work... > > > > пятница, 5 апреля 2013 г., > 12:54:54 UTC+4 пользователь > XumuK написал: > > It is clear. Troubles are > connected with such code: > > /var Renderer = > function(canvas){/ > /var that = {/ > /init:function(system){/ > /.../ > /},/ > // > /redraw:function(){/ > /..../ > /}/ > /initMouseHandling:function(){/ > /...../ > /}/ > /$(canvas).mousedown(handler.__c__licked);/ > /}/ > /return that;/ > /}/ > > пятница, 5 апреля 2013 г., > 12:15:55 UTC+4 > пользователь Apostolis > Xekoukoulotakis написал: > > > which I use to draw a > line: > > on: aCanvasId start: > aStartPoint end: > anEndPoint > > |canvas ctx| > > canvas := > ('#',aCanvasId) > asJQuery at:0. > console log:canvas. > ctx := canvas > getContext: '2d'. > ctx beginPath. > ctx moveTo: > > (aStartPoint y). > ctx lineTo: > (anEndPoint x) and: > (anEndPoint y). > ctx stroke. > > > > 2013/4/5 XumuK > <[hidden email]> > > I have some > troubles with > converting > javascript to > smalltalk. It`s > hard for me, and i > want to port this > JS to Amber for > learning.. > > пятница, 5 апреля > 2013 г., 11:08:15 > UTC+4 пользователь > Apostolis > Xekoukoulotakis > написал: > > I am currently > working and > learning the > canvas element > myself. What > > Getting the > canvas element > is the least > documented > thing you need > to do. > > After that, > you follow > those rules: > https://github.com/__ambe____r-smalltalk/amber/wiki/__From-__sm__alltalk-to-javascript-__and-__back > <https://github.com/amber-smalltalk/amber/wiki/From-smalltalk-to-javascript-and-back> > > > > <[hidden email]> > > I want to > rewrite > arbor.js > example > using > Amber. It > will help > me to > understand > Amber > more. > Could > > help me > with it? > > четверг, 4 > апреля > 2013 г., > 22:54:35 > UTC+4 > пользователь > XumuK написал: > > Greetings! > It is > possible > > convert created > JS > file > to ST > classes in > Amber? > > -- > You > received > this > message > because > you are > > to the > Groups > "amber-lang" > group. > To > unsubscribe from > this group > and stop > receiving > emails > from it, > send an > > amber-lang+...@__googlegroups.__co__m. > > For more > options, > visit > https://groups.google.com/__grou____ps/opt_out > <https://groups.google.com/groups/opt_out>. > > > > > > -- > > > Sincerely yours, > > Apostolis Xekoukoulotakis > > -- > You received this > > 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 > amber-lang+...@googlegroups.__co__m. > For more options, > visit > https://groups.google.com/__grou__ps/opt_out > > > > > > > -- > > > Sincerely yours, > > Apostolis Xekoukoulotakis > > -- > 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 > amber-lang+...@googlegroups.__com. > For more options, visit > https://groups.google.com/__groups/opt_out > <https://groups.googl > > > > -- > 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 > amber-lang+...@googlegroups.__com. > For more options, visit > https://groups.google.com/__groups/opt_out > <https://groups.google.com/groups/opt_out>. > > > > > > -- > > > Sincerely yours, > > Apostolis Xekoukoulotakis > > -- > You received this message because you are > subscribed to the Google Groups "amber-lang" > > To unsubscribe from this group and stop > receiving emails from it, send an email to > amber-lang+...@googlegroups.__com. > For more options, visit > https://groups.google.com/__groups/opt_out > <https://groups.google.com/groups/opt_out>. > > > > > -- > 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] > <javascript:>. > For more options, visit > https://groups.google.com/groups/opt_out > <https://groups.google.com/groups/opt_out>. > > > > -- > You received this message because you are subscribed to the Google > Groups "amber-lang" group. > To unsubscribe from this group and stop > an email to [hidden email]. > For more options, visit https://groups.google.com/groups/opt_out. > > -- 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/groups/opt_out. |
Ok, thanks.
I understood how to write a JS to eqiavivalent ST, it was only for study. Here is the result: https://github.com/hubbatov/GraphVisualizer Thanks to comunity for help.
-- понедельник, 15 апреля 2013 г., 12:50:39 UTC+4 пользователь Herby написал: Well, I don't know of one, and I doubt it will exist. It would, as I see it, defeat the amber's view which is "if it already exists in JS, use it as-is" (not everything is possible easily, like AngularJS and its scopes built on prototype inheritance, but many does). 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/groups/opt_out. |
In reply to this post by Herby Vojčík
Hi, Am 15.04.2013 10:50 schrieb "Herby Vojčík" <[hidden email]>: Right, if you already have JS code it is usually better to reuse it instead of rewriting it. Additionally I that there is also more than one way in JS to achieve the same behavior like in class-based programming languages. > I understand you are probably rewriting existing source from JS to ST to work with it in ST afterwards, but this is not the case very often, imo. Transforming JS into ST is probably a good practice to get to know the differences. Best, > 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/groups/opt_out. |
Free forum by Nabble | Edit this page |