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

feat: support canvas universal api #104

Merged
merged 6 commits into from
Jun 30, 2020
Merged

feat: support canvas universal api #104

merged 6 commits into from
Jun 30, 2020

Conversation

SoloJiang
Copy link
Collaborator

import { createElement, useEffect, Fragment } from 'rax';
import { createContext } from 'universal-canvas';

function App() {
  useEffect({
    createContext('canvas', '2d').then(context => {
      context.fillStyle = 'red';
      context.fillRect(0, 0, 100, 100);
      context.draw();
    });
  }, []);

  return (<>
    <canvas id='canvas'></canvas>
  </>)
}

createContext: (
selector: string,
type: string,
options: object
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这个 object 最好 interface 再描述下

}, []);

return (<>
<canvas id='canvas'></canvas>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

id 名称改一下,避免误导用户

@SoloJiang SoloJiang merged commit 0e262bb into master Jun 30, 2020
@delete-merged-branch delete-merged-branch bot deleted the feat-canvas branch June 30, 2020 03:35
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

Successfully merging this pull request may close these issues.

3 participants