Closed swampthang closed 5 years ago
First React
is not required for by package...
It's not in the package.json
or README.md
, where do you get that?
There may be multiple places need checking to make this work:
const color = await getColorHexRGB;
is not the same as the sample usage:import { clipboard } from 'electron'
import { getColorHexRGB } from 'electron-color-picker'
const getColor = async () => {
const color = await getColorHexRGB() // note the function call
color && clipboard.writeText(color)
}
you may need the latest electron v2.0.0
or v1.8.6
with node 8+
for un-transplied async
syntax, or use babel to complie code from package
this package is intended to be called in main thread, for render thread you may need to try with https://electronjs.org/docs/api/remote
Thanks for the reply and sorry for the delay in replying back. I don't remember seeing a notification that you replied.
First of all, I'm an idiot. I didn't mean react - I meant es6 - not able to use import. I may not be able to upgrade to the latest version of Electron because a few of the packages I'm using may not play together nicely. I'll give it a try. In the meantime, if you have any suggestions about how this can be done without having to use import I would greatly appreciate it.
The import
syntax is actually not required to this package. Though the source code do have the import
syntax, the published version of the package is babel compiled.
You can check the installed package under node_modules
, or just download one with npm pack electron-color-picker
.
Also you can check the newly added electron-color-picker#example for a basic setup.
An example of the release process of Electron app with this package is now add, after #2 .
A short description is added to #about-release-packaging. And a more complete dev & packing process has been added to
example/
, be sure to run & test that following #example.
When I stumbled upon this I was some kind of excited to think this is now possible so thanks for putting this up!
I'm not using react - just electron with nodejs, ie, const module = require('module');
In renderer I tried:
A button click listener calls...
Can you give a little more info on how this is supposed to be used in this environment? Would be greatly appreciated.
I see the following error on click:
Uncaught (in promise) TypeError: Error processing argument at index 0, conversion failure from async()=>{const{possibleColorString:r}=await o() const[t]=e.exec(r.toUpperCase())||[] if(!t)throw new Error(`[e......t}
at getColor()