chiquitinxx / grooscript-plugins

Grooscript plugins - Gradle and Grails 3
12 stars 1 forks source link

Grails 3 plugin: onLoad="true" doesn't work #2

Closed dilvan1 closed 8 years ago

dilvan1 commented 8 years ago

Just add onLoad="true" to one of the examples and the template doesn't run (using org.grails.plugins:grooscript:1.1.0):

 <grooscript:template onLoad="true">
            ul {
                5.times { number ->
                    li "$number li item"
                }
            }
</grooscript:template>
chiquitinxx commented 8 years ago

Hello!

Yes, it's bug. The default value of this option is true. Does it work with this code?

 <grooscript:template>
            ul {
                5.times { number ->
                    li "$number li item"
                }
            }
</grooscript:template>
dilvan1 commented 8 years ago

Hi,

The code works fine, the only problem is if you add onLoad=“true”. It doesn’t seem something difficult to fix.

Dilvan de Abreu Moreira, Ph.D. dilvan@gmail.com http://java.icmc.usp.br Warning: I use a spam filter, some emails sent to me CAN be lost!

On Mon, Aug 3, 2015 at 2:25 PM, Jorge Franco notifications@github.com wrote:

Hello!

Yes, it's bug. The default value of this option is true. Does it work with this code?

grooscript:template ul { 5.times { number -> li "$number li item" } }/grooscript:template

— Reply to this email directly or view it on GitHub https://github.com/chiquitinxx/grooscript-grails3-plugin/issues/2#issuecomment-127337035 .

chiquitinxx commented 8 years ago

There is a new version (1.1.1) with that fixes.

dilvan1 commented 8 years ago

Hi,

Not working yet for me: https://repo.grails.org/grails/core/org/grails/plugins/grooscript/1.1.1/grooscript-1.1.1.pom

I will try later.

Cheers,

Dilvan de Abreu Moreira, Ph.D. dilvan@gmail.com http://java.icmc.usp.br Warning: I use a spam filter, some emails sent to me CAN be lost!

On Tue, Aug 11, 2015 at 2:11 PM, Jorge Franco notifications@github.com wrote:

There is a new version (1.1.1) with that fixes.

— Reply to this email directly or view it on GitHub https://github.com/chiquitinxx/grooscript-grails3-plugin/issues/2#issuecomment-129973793 .

dilvan1 commented 8 years ago

Hi,

I would like to use React http://facebook.github.io/react/ and material ui http://material-ui.com/#/ (A Set of React Components that Implement Google's Material Design) with grooscript. In your demos, you have two examples: react https://github.com/chiquitinxx/grooscript-demos/tree/master/src/main/groovy/react and react-native https://github.com/chiquitinxx/grooscript-demos/tree/master/src/main/groovy/reactNative. Your react demo seems to be just grooscript code, which emulates React's behavior, but does not use the React framework. Is that correct? If so, if I want to use React http://facebook.github.io/react/ and material ui http://material-ui.com/#/ which demo code should I use as a start point?

Thanks,

Dilvan de Abreu Moreira, Ph.D. dilvan@gmail.com http://java.icmc.usp.br Warning: I use a spam filter, some emails sent to me CAN be lost!

chiquitinxx commented 8 years ago

Hello!

Yes, the first demo is using a groovy @AST to do things as react does. The second demo is using react native to make an ios application https://facebook.github.io/react-native/. I think you better start from scratch. React has some hacks, as use it own syntax, or use 'this' in javascript objects. Can be challenging use it from grooscript. If you do something, please share it :)

Good luck!

dilvan1 commented 8 years ago

Thanks for the tips! I am actually testing some possible technologies to port a project I have in GWT to grooscript. So, I am experimenting with React and polymer. Polymer is easier, I just have to convert to grooscript the element registration call (Would you prefer to do this conversion code yourself?) :

Is there anyone working with polymer+grooscript?

Also, about grooscript:

Dilvan de Abreu Moreira, Ph.D. dilvan@gmail.com http://java.icmc.usp.br Warning: I use a spam filter, some emails sent to me CAN be lost!

On Mon, Sep 7, 2015 at 7:51 PM, Jorge Franco notifications@github.com wrote:

Hello!

Yes, the first demo is using a groovy @AST https://github.com/AST to do things as react does. The second demo is using react native to make an ios application https://facebook.github.io/react-native/. I think you better start from scratch. React has some hacks, as use it own syntax, or use 'this' in javascript objects. Can be challenging use it from grooscript. If you do something, please share it :)

Good luck!

— Reply to this email directly or view it on GitHub https://github.com/chiquitinxx/grooscript-grails3-plugin/issues/2#issuecomment-138388177 .

chiquitinxx commented 8 years ago

Hello!

I asked in @grooscript twitter account for people using polymer.

No plans for source maps, I created an improvement issue in grooscript project. Maybe in the future.

No plans for Google closure, grooscript supports Require.js, and it has support for google closure. Also, you can use if you want to, is a tool that you can use with any js file.

dilvan1 commented 8 years ago

Hi,

You wrote:

On Thu, Sep 10, 2015 at 2:47 PM, Jorge Franco notifications@github.com wrote:

No plans for Google closure, grooscript supports Require.js, and it has support for google closure. Also, you can use if you want to, is a tool that you can use with any js file.

As I understand, you can only use Google Closure if the generated javascript of grooscript follows Google Closure rules. If it currently does, it would be a huge gain for grooscript to include Google Closure as its final compilation step. Does grooscript generate Google Closure compatible javascript?

BTW, Google Closure has a library to implement source maps (clojureScript uses it).

Cheers,

Dilvan.

— Reply to this email directly or view it on GitHub https://github.com/chiquitinxx/grooscript-grails3-plugin/issues/2#issuecomment-139322951 .

chiquitinxx commented 8 years ago

As far as I know, any Javascript code can be improved with Google Closure. It supports ECMAScript 5, used by grooscript. The optimization of javascript code can be managed after, by any task in your build or any plugin. There are a lot of options to optimize javascript code, no need to include in the grooscript core project.

For example take a look at this gradle plugin: https://github.com/eriwen/gradle-js-plugin

dilvan1 commented 8 years ago

Hi,

I am trying to interface grooscript to javascript in a subsystem of ePad http://epad.stanford.edu (a big GWT application). My questions:

  1. When a @GsNative method returns a javascript object, what is the type of this object in the Groovy side?
  2. In these returned javascript objects, can I call their javascript methods in the groovy side (without using @GsNative)?

    The question 2 occurred to me when I was analyzing your code for the Raphael demo https://github.com/chiquitinxx/grooscript-demos/blob/master/src/main/groovy/raphael/Stars.groovy. In it, there is a context field and you call methods in it (initAndMove method) that don’t seem to be defined anywhere. Do they come from javascript?

    BTW, is there a WebGL library for grooscript?

    Cheers,

    Dilvan de Abreu Moreira, Ph.D. dilvan@gmail.com http://java.icmc.usp.br Warning: I use a spam filter, some emails sent to me CAN be lost!

chiquitinxx commented 8 years ago

Hello!

There is no WebGl library for grooscript. Just you can to create a wrap if you want to use from the groovy side. Something similar is done in GQuery / GQueryImpl.

When a @GsNative method returns a javascript object, that javascript object can be used as it is. Is a javascript object with methods / properties you can use. Don't expect that object as a 'groovy' object or map, with the groovy methods / helpers. If you want to convert that object to a 'groovy' object, you can do that inside the javascript code.

In that starts demo, context is created in initCanvas method (gSobject.context = canvas.getContext("2d");). gSobject is like 'this', is a variable available in the context of your class that is the instance of the object.

Tell me if you don't understand, I can make a code to explain it better.

Thank you!