Ich versuche, node-vibrant im ng5-Projekt zu verwenden. Also versuche ich, das npm-Paket mit zu importieren
import Vibrant = require('node-vibrant');
//oder
Importieren Sie Vibrant von 'node-vibrant' ;
//oder
import * als Vibrant von 'node-vibrant/src/vibrant';
//oder
import Vibrant = require('node-vibrant/src/vibrant')
ohne Erfolg .
ich versuche es so zu benutzen
declare var Vibrant :any;
Vibrant.from('this.toPlayRadio.pic').getPalette(function(err, palette) {
console.log(palette);
});
but it return an error when use it
TypeError: this._canvas is undefined
Stack trace:
TypeError: this._canvas is undefined
BroswerImage.prototype.remove@http://localhost:8080/node_modules/node-vibrant/dist/vibrant.js:12676:9
Vibrant.prototype.getPalette/<@http://localhost:8080/node_modules/node-vibrant/dist/vibrant.js:7103:43
finallyHandler@http://localhost:8080/node_modules/node-vibrant/dist/vibrant.js:2593:15
tryCatcher@http://localhost:8080/node_modules/node-vibrant/dist/vibrant.js:5910:16
[22]_settlePromiseFromHandler@http://localhost:8080
...
and this is my tsconfig.json file
"compilerOptions": {
"target": "es5",
"module": "commonjs",
"moduleResolution": "node",
"sourceMap": true,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"removeComments": false,
"noImplicitAny": false,
"noStrictGenericChecks": true,
"skipLibCheck": true,
"allowSyntheticDefaultImports": true
}
and i use
"typescript": "^2.6.2",
so i am wondering how to use node-vibrant with ng5 , and how to correctly import it in ts class
import('Knoten-schwingend').then((schwingend) => {
// hier codieren
})
@amirping , ich denke, das Problem besteht darin, dass die Bibliothek das Bild nicht lädt. In #61 sehen Sie sich dieses Commit an .
@amirping
Ich habe es geschafft, es wie folgt zu verwenden -
const vibrant = require('node-vibrant');
Können wir mit v 3.1.1
bestätigen, dass die Verwendung von import Vibrant = require('node-vibrant')
funktioniert?
@crutchcorn
Habe sowohl import Vibrant = require('node-vibrant')
als auch const Vibrant = require('node-vibrant')
Ersteres ergibt #90. Letzteres ergibt #85.
Danke fürs Testen. Ich schaue diese Woche mal genauer nach
Hilfreichster Kommentar
@crutchcorn
Habe sowohl
import Vibrant = require('node-vibrant')
als auchconst Vibrant = require('node-vibrant')
Ersteres ergibt #90. Letzteres ergibt #85.