PDA

View Full Version : [FIXED] Application functions do not save their content



gatherworks
27 Mar 2012, 1:16 PM
My challenge is that I am trying to create "global" helper functions and I am not sure the best way to do it within Designer. Any recommendations?

So I created an application function and gave it 3 parameters. Question: How do I call that function from within the application?

Now when I put code into the function and save it, the generated files do not contain the content. Further more if you quit the app, you will see a prompt telling you that you have unsaved changes. If I make changes somewhere else in the app and save, it will allow me to exit the app without getting the warning, but then the content of the application functions are lost.

If I want to create a singleton class that does not extend any of your components so that I can use that, should I do this in the application's launch method or is there a better way to do that?

bseddon
28 Mar 2012, 2:12 AM
I see that behavior too. The project can be saved when function added to the application object of a project contains no code. If the function contains any code the project always appears to be unsaved. Also, the function cannot be deleted. After deletion the function disappears from the project hierarchy panel but it is still emitted and appears when the application node is selected.

Your question is a good one. What is the recommended way to add global function or other code on which an application might rely? At the moment my approach is to use an index.html instead of relying on designer.html because additional script references can be added to it. However it does mean I cannot use the preview function.

aconran
28 Mar 2012, 7:25 AM
First off, let me say we are aware that there are problems with the current public build regarding application.

These are resolved in build > 341 and will be part of the next update.

For functionality that is global to the application I would recommend adding it directly to the application as you have done above. Once the next build goes out you should be able to do this easily.

Note: There is no way to create a singleton class that does not extend any of our own classes. We are aware of this limitation and will look to address it after the 2.0 stable GA build.