Giter Club home page Giter Club logo

Comments (5)

wonderwhy-er avatar wonderwhy-er commented on June 4, 2024 2

Well reason I asked for this is that I did fail to make it work in some simple case.
Like here create vanilla typescript project on codesandbox and added just your import example.
https://codesandbox.io/s/vibrant-euclid-hxfxz?file=/src/index.ts

Could be problem with how they package.
But neither it works on RunKit to which you can go from npm page.
https://npm.runkit.com/%40gripeless%2Fpico

So yeah I asked for some example project that has both code and published online to play around.

from pico.

brizer avatar brizer commented on June 4, 2024

It is a good idea!

from pico.

JensUweB avatar JensUweB commented on June 4, 2024

I don't know what frontend framework / library you're using, but in angular the implementation is dead simple:

  • Install package: npm install @gripeless/pico
  • add Window to providers array in AppModule:
@NgModule({
  declarations: [
    // Components
    AppComponent,
  ],
  imports: [
   //..
 ],
  providers: [{ provide: Window, useValue: window }],
  bootstrap: [AppComponent],
})
export class AppModule {}
  • take a picture
import * as Pico from '@gripeless/pico';

@Injectable({
  providedIn: 'root',
})
export class TicketService {
async doScreenShot() {
    // ...
    const screenshot = (await Pico.dataURL(window, {})).value;
    console.log(screenshot ); // for debugging only
    return screenshot;
  }
}

If you don't know angular: It uses not normal javascript, but its superset typescript.

from pico.

jamesta696 avatar jamesta696 commented on June 4, 2024

Thanks for routing me to this example thread, unfortunately all examples are not working, resulting in "SyntaxError: Unexpected token" or "$csb__fluture.parallel is not a function".

from pico.

TomasKovacikArtin avatar TomasKovacikArtin commented on June 4, 2024

@JensUweB and what abotu the ignore option? Its failing if I provide { ignore: ['#to-ignore']}

from pico.

marcusx2 avatar marcusx2 commented on June 4, 2024

Can any kind soul provide me the minified js file of this library?

from pico.

Related Issues (16)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.