Comment 3 for bug 1187933

Revision history for this message
Robert Steckroth (robertsteckroth) wrote : Re: [Bug 1187933] Re: script.js should contain a function with members instead of global variables.

Also, are you using Qt Creator? It has a ton of useful feature for this
type of work. CTL+space to auto complete is priceless!

On Fri, Jun 7, 2013 at 8:24 AM, Robert Steckroth
<email address hidden>wrote:

> Well, there is no such thing as constants technically. If you want to
> disassociate a variable from the QML, use a function call with variables
> declared inside that scope.
> Otherwise, the property [type] [name]: value will have to do.
> Your script.js can look like this -->
> var a = function() {
> this.b = "hello world"
> }
> var c = new a
>
>
> In the qml, just use the function and members -->
> import "script.js" as myA
>
> console.log(c.b) outputs --> "hello world"
>
>
> i may help with your project this weekend, you have done a great job with
> the QML parenting and structure.
>
>
>
>
>
>
>
>
>
> On Fri, Jun 7, 2013 at 7:55 AM, Ping-Hsun Chen <email address hidden> wrote:
>
>> What's the best practice in QML to handle constants?
>>
>> --
>> You received this bug notification because you are subscribed to the bug
>> report.
>> https://bugs.launchpad.net/bugs/1187933
>>
>> Title:
>> script.js should contain a function with members instead of global
>> variables.
>>
>> Status in The Web Browser with a Hamburger Button:
>> Confirmed
>>
>> Bug description:
>> This will necessitate better code design throughout the application.
>>
>> To manage notifications about this bug go to:
>> https://bugs.launchpad.net/slatekit-shell/+bug/1187933/+subscriptions
>>
>
>
>
> --
> Bust0ut, Surgemcgee: Systems/Web/Software Engineer
>
> "Freedom is empowered by those without power" - Robert Edward Steckroth II
> "Injustice, regarding the internet, is fashioned through laws and
> enforcement" - Robert Edward Steckroth II
> "Reality is the fuel of the universe and the roadblock to human
> understanding" - Robert Edward Steckroth II
>
>
>

--
Bust0ut, Surgemcgee: Systems/Web/Software Engineer

"Freedom is empowered by those without power" - Robert Edward Steckroth II
"Injustice, regarding the internet, is fashioned through laws and
enforcement" - Robert Edward Steckroth II
"Reality is the fuel of the universe and the roadblock to human
understanding" - Robert Edward Steckroth II