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 nwjs(node-webkit) supported? #445

Closed
leaysgur opened this issue Feb 20, 2015 · 5 comments
Closed

Is nwjs(node-webkit) supported? #445

leaysgur opened this issue Feb 20, 2015 · 5 comments

Comments

@leaysgur
Copy link

@julianshapiro

Hi, thank you for nice lib ;D

I'm now developing my app with Velocity on nwjs(node-webkit).
And I have to support both two nwjs versions below.

// maintained stable
node-webkit: "0.8.6"
chromium: "30.0.1599.66"
node: "0.10.22"
v8: "3.20.15.5"

and

// maintained latest
node-webkit: "0.11.6"
chromium: "38.0.2125.104"
node: "0.11.13-pre"
v8: "3.28.71.2"

My problem is "Error occurs only on maintained stable".
Minimal sample is below.

<!DOCTYPE html>
<html>
<head>
  <meta charset="UTF-8">
  <title>nwjs - Velocity</title>
</head>
<body>
<div id="test" style="background-color: blue; color: #fff; width: 300px; height: 300px;">Fadeout</div>
<script src="https://cdnjs.cloudflare.com/ajax/libs/velocity/1.2.2/velocity.js"></script>
<script>
Velocity(document.getElementById('test'), 'fadeOut', {
  complete: function() { alert('Done'); }
});
</script>
</body>
</html>

Animation has completed but, it's end up with some error.

Uncaught TypeError: object is not a function velocity.js:3691
Uncaught TypeError: Property 'resolver' of object #<Object> is not a function velocity.js:3681

According to my examined, implementation of 'Promise' was different.

Latest one(with node v11) has native Promise, works propery.
But stable one has nwjs original? Promise, occurs error.

Both has window.Promise, so same code executed, but it works different...
Is there a way to avoid this?

Sorry to my poor english X(

@ydaniv
Copy link
Contributor

ydaniv commented Feb 20, 2015

Try including a library that implements it according to the Promises A+ spec and set its Promise to Velocity.Promise.

@leaysgur
Copy link
Author

Thank you for the comment.

Is hard to say, but my problem is a little more complicated..
This error occurs in iframe contentWindow, so I can't fix Promise from outer.

Of course, I can load Promise A+ shim(like bluebird) on outer.
But it does not seem to affect the in iframe scope.

@ydaniv
Copy link
Contributor

ydaniv commented Feb 21, 2015

So this is not a Velocity issue, then.

@leaysgur
Copy link
Author

Hmm, ok.

Thanks anyway.

@Duder-onomy
Copy link

If anyone stumbles here through google.

The posted solution works for me, on LG Smart TV's (nodeWebkit) Velocity does not work because the Promise implementation is incorrect.

Patching Velocity.Promise with bluebird solves the issue.

var velocity = require('velocity'),
    bluebird = require('bluebird');

velocity.Promise = bluebird;

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

3 participants