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

Switch layout vs show keyset #502

Closed
tobiasvandriessel opened this issue Jan 2, 2017 · 8 comments
Closed

Switch layout vs show keyset #502

tobiasvandriessel opened this issue Jan 2, 2017 · 8 comments

Comments

@tobiasvandriessel
Copy link

tobiasvandriessel commented Jan 2, 2017

It's probably a strange question, but performance-wise, what is faster considering a layout of 10 rows and 17 columns, Switching the Layout or Showing a different KeySet? And please do tell me if there's a better way to ask such questions.

@Mottie
Copy link
Owner

Mottie commented Jan 2, 2017

Hi @tobiasvandriessel!

I haven't done any performance testing, but switching keysets is going to be faster since the HTML is already present in the DOM and only the display setting is modified.

When you switch a layout, it needs to build the HTML, if not already built. If the layout has been built, it clones the stored keyboard and makes any necessary additions like adding a preview and adding a hidden element to measure scroll position.

Have you encountered an issue where one is much slower than the other?

@tobiasvandriessel
Copy link
Author

Hi @Mottie, again thanks for your quick reply! My expectations were indeed that you handled the switching of keysets in a smarter way than just rebuilding the whole keyboard, but I had no way of confirming as a lot of your JavaScript code looks like a big soup to me haha.

I was asking because I need to handle some mobile or simply low-powered devices and wouldn't like wasting precious client's time :p

Consider the issue closed :)

@Mottie
Copy link
Owner

Mottie commented Jan 2, 2017

LOL yeah, it is a mess. I plan on rewriting the code soon-ish...

@tobiasvandriessel
Copy link
Author

Oh sorry, it was in no way meant as a negative remark, I'm just to C# and thus a JavaScript noob :p Nonetheless, if you as well think it's a mess and you have the time, it might just be beneficial. The next question will be very off topic, so feel free not answer. You seem quite experienced with JavaScript and JQuery, how do you view TypeScript and its types? Do you plan on using it in your next project?

@Mottie
Copy link
Owner

Mottie commented Jan 2, 2017

I've never used TypeScript, so probably not LOL! Do you think it's worth learning?

@tobiasvandriessel
Copy link
Author

Haha me neither, but for me it's a nice wrapper around Javascript, with the types making programming and debugging more manageable. I truly wouldn't know whether learning it is worth it, but recently there was quite some momentum behind it, so I was very curious about your view on the introduction of types given your experience.

@Mottie
Copy link
Owner

Mottie commented Jan 5, 2017

FYI, in v1.26.8, I added a new parameter to the redraw function that allows quick layout switching for the main keyboard:

keyboard.redraw("new_layout");

The keyboard object is provided within callback functions and action key functions; or you can access it any time using:

var keyboard = $("#keyboard").data("keyboard");

@tobiasvandriessel
Copy link
Author

Ah very nice, compacter code!
Thanks! I'm starting to figure it all out xD

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