Jump to content
GreenSock

Stefdv

Node-webkit support

Warning: Please note

This thread was started before GSAP 3 was released. Some information, especially the syntax, may be out of date for GSAP 3. Please see the GSAP 3 migration guide and release notes for more information about how to update the code to GSAP 3's syntax. 

Recommended Posts

I loved GSAP in the Flash days, love it even more in javascript...

 

And then came Node-webkit, a way to make hybrid  desktop apps. The only problem is that i can not use TweenMax or Draggable with it. Node-webkit uses require() ( witch is actually based on CommonJs instead of RequireJs) 

 

When i load the libraries thru index.html using a script tag, i can use them in the main.js file, but then there not available in other modules. ( something to do with different contexts ). So the only way would be to be able to load them with something like  

var TweenMax = require('./TweenMax')

 

I know you are all very busy perfecting GSAP ;), but is there any change you can help me out here ?

Link to comment
Share on other sites

Hm, I'm not familiar with Node-webkit or its requirements. Can you provide some more details? 

 

This may help: did you know that you can define a GreenSockGlobals object before you load GSAP files and then it'll dump all the globals into that object instead of the window level? I'm not entirely sure if that solves anything for you.

 

Are you able to define a JavaScript object in your index.html, for example, and then access it inside your other modules? If so, the GreenSockGlobals may be a great solution for you. 

 

Kinda like...

<script>var gs = window.GreenSockGlobals = {};</script>
<script src="TweenMax.min.js"></script>
<script>
    var TweenMax = gs.TweenMax;
    TweenMax.to(...);
</script>
  • Like 1
Link to comment
Share on other sites

Tx :)  Fast response like always on this forum :)

 

I didn't know about the GreenSockGlobals, but i fixed it in a simulair way.  In Node-webkit there is the fact that node and webkit live in their own context so by assigning TweenMax from the webkit window to the global window the problem is solved and i can use TweenMax in every other module to.

 

global.Tweenmax = window.TweenMax 
 
Tx for the reply .
  • Like 1
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×