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

Feature request: JS callouts extentability #125

Closed
tablatronix opened this issue Nov 29, 2019 · 10 comments
Closed

Feature request: JS callouts extentability #125

tablatronix opened this issue Nov 29, 2019 · 10 comments
Labels
wishlist Good to have features

Comments

@tablatronix
Copy link

Some kind of JS event callout hooks to extend functionality, eg.

I am playing around with something like this, could also be tied into things like inventory control and picking etc.

https://youtu.be/oZNod_Mhfro

@tablatronix tablatronix changed the title Feature requestJS callouts extentability Feature request: JS callouts extentability Nov 29, 2019
@qu1ck
Copy link
Member

qu1ck commented Nov 29, 2019

Can you expand on what you mean by JS callouts? Maybe an example of integration with outside system?

@tablatronix
Copy link
Author

tablatronix commented Nov 29, 2019

That yt video is an example, and the desc is pretty large.

Just events for current selected item etc. and passing some attributes or at least a primary key, and maybe some info like placed or not.

I just hacked in an xhr for example to pass data to a host I control in this example...

function createRowHighlightHandler(rowid, refs) {
...
    // Do something custom with what we know is selected...
     URL = "http://192.168.1.246/?ledindex="+rowid.replace("bomrow","");
    let xhr = new XMLHttpRequest();
    xhr.open("GET", URL,true);
    xhr.send();

@qu1ck
Copy link
Member

qu1ck commented Nov 29, 2019

I see. Well these are hardly JS callouts, more like http callbacks but it's semantics.
I will think about good way to implement it. What events other than highlight do you think would be useful to have callbacks for?

@qu1ck qu1ck added the wishlist Good to have features label Nov 29, 2019
@tablatronix
Copy link
Author

sorry , I meant callouts in JS, not actual 'JS callouts' is that a thing?

functionally to callout to a users control function or trigger an event for customization or action.

@qu1ck
Copy link
Member

qu1ck commented Nov 29, 2019

I'm not an expert but probably in pure JS apps it's a thing, not in web since browsers sandbox everything.

@tablatronix
Copy link
Author

ok well to be clear the xhr call has nothing to do with this.

Might be able to just get away with event listeners, but it depends on the scope of how to allow including user code assets. And what data we need to pass to the function etc

@qu1ck
Copy link
Member

qu1ck commented Nov 29, 2019

I agree, it's better to make it generic and not limited to http requests.
I think I'll add ability to inject user js code at bom generation time and that code will be able to add listeners to some events like highlight change, checkbox state change, etc. Then you can do whatever you want in your code.

@tablatronix
Copy link
Author

Have you thought about this anymore?

@qu1ck
Copy link
Member

qu1ck commented Apr 27, 2020

Yes, I have a plan to implement the injectable user js code with listeners as described above and also injectable css and html headers/footers. Just have to find time to implement it.

@qu1ck
Copy link
Member

qu1ck commented May 1, 2020

This is now supported. In InteractiveHtmlBom/web/user-file-examples there are some examples you can copy over into InteractiveHtmlBom/web to check how they work and edit as you like.

I will add more info to the wiki soon.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
wishlist Good to have features
Projects
None yet
Development

No branches or pull requests

2 participants