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

Provide a registry API for supported elements/media types #42

Open
ocean90 opened this issue Nov 20, 2020 · 3 comments
Open

Provide a registry API for supported elements/media types #42

ocean90 opened this issue Nov 20, 2020 · 3 comments
Labels
enhancement New feature or request

Comments

@ocean90
Copy link
Collaborator

ocean90 commented Nov 20, 2020

By default the library supports images, inline HTML, iframes and YouTube videos. There's already a comment "you can add new type to support something new" but that's not true unless you change the source directly.
Idea: Provide an API that allows to add and remove media types.

This is related to #1 to split the library into modules. I think it would be nice if each media type is its own module which can be added manually. This should reduce the package size for users who want to use the library only for images.
A possible implementation may look like this:

// import Tobii from 'tobii'; // This would continue to include all types
import { Base as Tobii } from 'tobii'; // This one requires you to manually register the types
import image from 'tobii/types/image';
import youtube from 'tobii/types/youtube';
import myCustomType from './my-custom-type';

Tobii.registerType(image);
Tobii.registerType(youtube);
Tobii.registerType(myCustomType);

new Tobii();

Inspired by the Day.js library.

What are your thoughts on this idea? Are there better implementation ideas?

@midzer
Copy link
Owner

midzer commented Nov 20, 2020

I really like the idea! The possibility to have smaller bundle sizes is always good.

I'm kind of stuck at #1 and any help is warmly appreciated.

@midzer midzer added the enhancement New feature or request label Jan 6, 2021
@viliusle
Copy link
Collaborator

viliusle commented Jun 21, 2021

Maybe it is too old ticket to reply, but do we really want to reduce file size, if total library size is only 8.6 kb compressed? It is already small.

p.s. I checked other 2 similar libs, results were 22kb and 38kb.

@midzer
Copy link
Owner

midzer commented Jun 21, 2021

@viliusle You're right. I think we have no urgency. But if some1 is willing to jump on this item, it would be nice for a tobii v3.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants