Running the Counter example

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Running the Counter example

Rodo
Hi group, I'm new to Amber Smalltalk and I was wondering, is it
possible to run the Counter example without installing Amber on my PC?
So, basically I want to run it from http://http://amber-lang.net/.

Is this possible and if so how exactly?

Regards,

Ron
Reply | Threaded
Open this post in threaded view
|

Re: Running the Counter example

Nicolas Petton
On Mon, 2012-01-16 at 05:32 -0800, Ron wrote:
> Hi group, I'm new to Amber Smalltalk and I was wondering, is it
> possible to run the Counter example without installing Amber on my PC?
> So, basically I want to run it from http://http://amber-lang.net/.
>
> Is this possible and if so how exactly?
>

Hi! Welcome Ron!

It's possible, open the IDE, and in a workspace do it:

Counter new appendToJQuery: 'body' asJQuery

This will append the counter to the <body> element of the page, using
JQuery.

HTH,
Nico

> Regards,
>
> Ron


Reply | Threaded
Open this post in threaded view
|

Re: Running the Counter example

Rodo
Hi Nico,

Thanks for the quick reply.

Ok, I had found that already but somehow expected to see the counter
example in a fresh browser tab, but I see now the counter is appended
in the current page ;)

Is it possible to open the counter example in a new browser page?

Regards,

Ron

On 16 jan, 14:35, Nicolas Petton <[hidden email]> wrote:

> On Mon, 2012-01-16 at 05:32 -0800, Ron wrote:
> > Hi group, I'm new to Amber Smalltalk and I was wondering, is it
> > possible to run the Counter example without installing Amber on my PC?
> > So, basically I want to run it fromhttp://http://amber-lang.net/.
>
> > Is this possible and if so how exactly?
>
> Hi! Welcome Ron!
>
> It's possible, open the IDE, and in a workspace do it:
>
> Counter new appendToJQuery: 'body' asJQuery
>
> This will append the counter to the <body> element of the page, using
> JQuery.
>
> HTH,
> Nico
>
>
>
>
>
>
>
> > Regards,
>
> > Ron
Reply | Threaded
Open this post in threaded view
|

Re: Running the Counter example

Nicolas Petton
On Mon, 2012-01-16 at 05:53 -0800, Ron wrote:
> Hi Nico,
>
> Thanks for the quick reply.
>
> Ok, I had found that already but somehow expected to see the counter
> example in a fresh browser tab, but I see now the counter is appended
> in the current page ;)
>
> Is it possible to open the counter example in a new browser page?

yes it is. There are several ways to do that.

First, you'll need to create an empty HTML page counter.html with
amber.js loaded like in the index.html page.

In the loadAmber() function, load a counter like this:

loadAmber({
    ready: function() {
      $(function() {
        smalltalk.Counter._new()._appendToJQuery_('body'._asJQuery());
      });
}});


Another solution that doesn't require a JS function is to add a
class-side #initialize method in some class (the Counter class for
example):

Counter class >> initialize
        self new appendToJQuery: 'body' asJQuery

The #initialize method will be called on page load.

This is the method used for the Presentation slides at:
http://nicolas-petton.fr/presentations/esug2011/

Cheers,
Nico

>
> Regards,
>
> Ron
>
> On 16 jan, 14:35, Nicolas Petton <[hidden email]> wrote:
> > On Mon, 2012-01-16 at 05:32 -0800, Ron wrote:
> > > Hi group, I'm new to Amber Smalltalk and I was wondering, is it
> > > possible to run the Counter example without installing Amber on my PC?
> > > So, basically I want to run it fromhttp://http://amber-lang.net/.
> >
> > > Is this possible and if so how exactly?
> >
> > Hi! Welcome Ron!
> >
> > It's possible, open the IDE, and in a workspace do it:
> >
> > Counter new appendToJQuery: 'body' asJQuery
> >
> > This will append the counter to the <body> element of the page, using
> > JQuery.
> >
> > HTH,
> > Nico
> >
> >
> >
> >
> >
> >
> >
> > > Regards,
> >
> > > Ron