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

getPallete running multiple times #34

Closed
eybarta opened this issue Jan 30, 2017 · 5 comments
Closed

getPallete running multiple times #34

eybarta opened this issue Jan 30, 2017 · 5 comments

Comments

@eybarta
Copy link

eybarta commented Jan 30, 2017

Hi thanks for awesome plugin..

I'm running this code:


console.log("this happends once");

Vibrant.from(this.image).getPalette((err, palette) => {

        console.log("this happends 3 times")

        for (color in palette) {
               if (this.colors.length<5 && !!palette[color].rgb)
                    this.colors.push(palette[color].rgb.join(','))
        }
})

the Vibrant code works fine except it runs multiple times instead of once, I'm not sure
what I'm doing wrong here.. could you please help me figure out this issue?

thnx!

@akfish
Copy link
Member

akfish commented Feb 1, 2017

I cannot reproduce this issue on my end. The callback is called exactly once.
You could try adding a break point inside the callback or print the stack trace to identify the callsites and see where the extra calls originate.

@Uriziel01
Copy link

I'm having the exact same issue. Will try to prepare some jsFiddle example later today.

@akfish
Copy link
Member

akfish commented Feb 27, 2017

I just published v3.0.0-alpha.1. Could you see if this issue persists in the new version?

@Uriziel01
Copy link

Yes, now it works like a charm (triggering only once). 👍

It should be a separate issue but I just want to drop a quick note that it bothers me that loading v3.0.0.alpha.1 using async import:

System.import('node-vibrant').then(function (importedObject) {
    self.vibrant = importedObject;
});

will not work because object returned from System.import is an empty object, I have to use it like so:

System.import('node-vibrant').then(function (importedObject) {
    self.vibrant = Vibrant;
});

It was working correctly in previous vibrant versions.

@akfish
Copy link
Member

akfish commented Feb 28, 2017

Good to know.

I opened a separate issue to track the other issue. #40

@akfish akfish closed this as completed Feb 28, 2017
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