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

Methods to handle runtime-created elements #50

Open
pjc0247 opened this issue Nov 13, 2018 · 4 comments
Open

Methods to handle runtime-created elements #50

pjc0247 opened this issue Nov 13, 2018 · 4 comments

Comments

@pjc0247
Copy link

pjc0247 commented Nov 13, 2018

I read your docs and assumed that there is no API provided to handle lazy-loaded element.
It would be great to give a chance to handle it like below:

var c = document.getElementById("SOME_CANVAAS");
flifify_or_something (c);

Thanks.

@hrj
Copy link
Member

hrj commented Nov 13, 2018

The low level API allows this, but you will have to fetch the data yourself. Example:

var c = document.getElementById("...");    // get canvas element somehow
var buffer = ...                           // get data in Uint8Array; via XHR, for example.

var pf = new PolyFlif({
  canvas: c,
  buf:    buffer
});

pf.beginPercent(true, 0, 0, 0);

@pjc0247
Copy link
Author

pjc0247 commented Nov 13, 2018

@hrj Yeah, maybe that would be an answer. but what I want to say is the conviences.

@hrj
Copy link
Member

hrj commented Nov 13, 2018

@pjc0247 Sure, but which part is inconvenient? I want to support maximum flexibility with minimum API. Given that the above example is just a couple of lines of code, I think it is a good tradeoff between flexibility and minimalism.

@pjc0247
Copy link
Author

pjc0247 commented Nov 14, 2018

@hrj Because, I have to fill out the buffer myself and params (x, 0, 0, 0) is not intuitive.

You've already implemented everything such as DOM controlling, fetching, initializing(beginPercent). but you didn't expose it.
So I need to make a wrapper even if there is a full implementation somewhere.

At least, additional url or src option in current API would be great.

Thanks

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

No branches or pull requests

2 participants