Skip to content
This repository has been archived by the owner on Jul 1, 2021. It is now read-only.

canvas.getContext() not working when canvas created with basicHTML. #32

Closed
Divy123 opened this issue Dec 26, 2018 · 5 comments
Closed

Comments

@Divy123
Copy link

Divy123 commented Dec 26, 2018

I was trying to implement this:

var canvas;
    if (options.inBrowser) {
      canvas = document.querySelector(selector);
    }
    else {
      const { Document } = require('basichtml');
      const document = new Document();
      // common accessors
      document.documentElement.innerHTML = `
        <canvas id='image-sequencer-canvas'></canvas>
      `;
      canvas = document.querySelector('#image-sequencer-canvas');
    }

and then

var gl;
gl = canvas.getContext(names[i], { preserveDrawingBuffer: true });

but gl always turns out to be undefined.
Please help.
@WebReflection

@WebReflection
Copy link
Owner

I'm sorry, what are you trying to do with a canvas here?

@WebReflection
Copy link
Owner

Just to clarify, implementing the whole 2d/3d canvas API in here is way beyond the scope of this project.

I might consider exposing some special method you can hook into it for the canvas, but I'll never make getContext work in here.

Would that work?

@WebReflection
Copy link
Owner

Since the issue was from last year and there are no answers, I'll close this.

@WebReflection
Copy link
Owner

FYI version 1 has both canvas and image implemented.
See https://github.com/WebReflection/basicHTML#new-in-v1

@bigopon
Copy link
Contributor

bigopon commented Jul 2, 2019

@WebReflection lol nice job 🎉

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants