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

Is it possible to use this inside electronjs? #231

Closed
solancer opened this issue Aug 10, 2017 · 9 comments
Closed

Is it possible to use this inside electronjs? #231

solancer opened this issue Aug 10, 2017 · 9 comments

Comments

@solancer
Copy link

solancer commented Aug 10, 2017

Is it possible to use this inside electronjs apps? since window.prompt is not an option inside electronjs?

apparently not all the methods in the object are available inside electronjs

screen shot 2017-08-10 at 10 12 52 pm

@bbatliner
Copy link
Collaborator

Have you tried using it in an electron app? I believe it should work. Let me know!

@solancer
Copy link
Author

yes I did try, the above screenshot is error log from the dev tools of my electron js app

@bbatliner
Copy link
Collaborator

I don't see any errors in your console. Did the dialog show on screen when you opened one?

@solancer
Copy link
Author

no it doesn't show a dialog

@solancer
Copy link
Author

in the log you will see that logging vex on the console gives only a few methods

@PixievoltNo1
Copy link
Contributor

Do you have the right file? Those are all the methods you'd get from vex.min.js; you'd need vex.combined.min.js to get the vex.dialog object.

@bbatliner
Copy link
Collaborator

Closing because we never found any evidence of something going wrong... Please reopen if you're still having a problem.

@megancooper
Copy link

Not sure if this is the same issue, but after trying to use this in an Electron app, I am seeing an error implying vex can't access the window object from the renderer process:

Uncaught TypeError: Cannot read property 'alert' of undefined
    at eval (index.js:79)
    at HTMLUnknownElement.callCallback (react-dom.development.js:149)
    at Object.invokeGuardedCallbackDev (react-dom.development.js:199)
    at invokeGuardedCallback (react-dom.development.js:256)
    at invokeGuardedCallbackAndCatchFirstError (react-dom.development.js:270)
    at executeDispatch (react-dom.development.js:561)
    at executeDispatchesInOrder (react-dom.development.js:583)
    at executeDispatchesAndRelease (react-dom.development.js:680)
    at executeDispatchesAndReleaseTopLevel (react-dom.development.js:688)
    at forEachAccumulated (react-dom.development.js:662)
    at runEventsInBatch (react-dom.development.js:816)
    at runExtractedEventsInBatch (react-dom.development.js:824)
    at handleTopLevel (react-dom.development.js:4826)
    at batchedUpdates$1 (react-dom.development.js:20439)
    at batchedUpdates (react-dom.development.js:2151)
    at dispatchEvent (react-dom.development.js:4905)

@vitor251093
Copy link

vitor251093 commented Jun 30, 2020

I can say the same that happened with @solancer does happened to me as well. I've created a dialogs.js file:

var vex = require('vex-js')
vex.registerPlugin(require('vex-dialog'))
vex.defaultOptions.className = 'vex-theme-os'

module.exports = vex.dialog;

Then I've imported it in a different file:

        var Dialogs   = require('../utils/misc/dialogs')
        
        [...]
        
        console.log(Dialogs)
        Dialogs.open({
            message: 'Which is the user name?',
            input: '<input name="username" type="text" placeholder="" required />',
            buttons: [
                _.assign({}, Dialogs.buttons.YES, { text: 'Confirm' }),
                _.assign({}, Dialogs.buttons.NO,  { text: 'Cancel'  })
            ],
            callback: function (data) {
                if (data) {
                    var name = data.username
                    console.log(name)
                }
            }
        })

While console.log does work, and shows that the Dialogs variable does exist, the input prompt itself never appears.

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

5 participants