Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Minimal Installation (with just promise.js, PromiseTimer.qml) #12

Open
hstig opened this issue May 11, 2022 · 1 comment
Open

Minimal Installation (with just promise.js, PromiseTimer.qml) #12

hstig opened this issue May 11, 2022 · 1 comment

Comments

@hstig
Copy link

hstig commented May 11, 2022

Rplaced the code in Minimal Installation...

                var promise = new Q.Promise(function(resolve, reject) {

                    // ...

                });            

with...

                let promise = Q.promise(function(resolve, reject) {

                    resolve('my promise');

                }).then(function(value){

                    console.log(value);

                });            

...and added paths of both files into qml.qrc!

<RCC>
    <qresource prefix="/">
        <file>main.qml</file>
        <file>QuickPromise/promise.js</file>
        <file>QuickPromise/PromiseTimer.qml</file>
    </qresource>
</RCC>

After this Minimal Installation works with

import QtQuick 2.12

import Qt.labs.platform 1.1

import QtQuick.Controls 2.12

import "./QuickPromise/promise.js" as Q



ApplicationWindow {



    visible: true



    Rectangle{

        visible: true

        width: parent.width

        height: parent.width

                

        Button{

            width: parent.width

            height: parent.width

            

            text: "Test"

            onClicked: {

                console.log("----------- new Q.Promise(function(resolve, reject) ---------------------")

                var promise = Q.promise(function(resolve, reject) {

                    resolve("my promise");

                }).then(function(value){

                    console.log(value);

                });            



            }

        }

    }

}

When Button 'Test' is pressed, it results in:

qml: ----------- new Q.Promise(function(resolve, reject) ---------------------

qml: my promise

@hstig hstig changed the title Minimal Install (with just promise.js, PromiseTimer.qml) Minimal Installation (with just promise.js, PromiseTimer.qml) May 11, 2022
@hstig
Copy link
Author

hstig commented May 11, 2022

@benlau Please be more clear in Minimal Installation . And replace every 'Q.Promise' with 'Q.promise'.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant