Code Monkey home page Code Monkey logo

Comments (2)

mitchcapper avatar mitchcapper commented on September 24, 2024

I looked at doing a PR to add a deferral option for events but when investigating the relevant code realized the fact the code executes a singular event at a time and with the locks there wouldn't be a easy way for background handlers. Including even if holding onto the relevant info for afterwards (and either allowing the user to take a deferral or having a binding the user specifies they would always set the result when finished). While one could do those things, given the one event at a time until a result is returned would eliminate the benefits.

This isn't a huge deal for the .net library we can add our own bind function and relevant JS code and just handle the magic in JS land while allowing async actions in .net as well. Once we have a sample will post it back.

As a minor side note I assumed above that the normal bind (non interface) calls were properly binding functions into the global namespace in JS but they don't either.

from webui.

AlbertShown avatar AlbertShown commented on September 24, 2024

I believe the wrapper interface (webui_interface_*) is to make it a bit easier
than the non-interface ones

Yes, webui_interface_xxx functions are simply a wrapper of webui APIs in a simplified format to make things easier for wrappers.

sounds like webui_bind when called with the ID of something not in the DOM
registers the function to webui.call("FuncName")

This is in purpose, if the user do webui_bind("Foo"), it does not mean there is a DOM object called Foo, but simply he wants to make webui.call("Foo") available, therefor, webui will create Foo object, so Foo() will be available globally.

Calling the interface version does not though
there we only see bound functions from webui.call("*")

Can you please clarify more this section?

It does almost require callback interop though
so it isn't as if supporting some level of async wouldn't be possible

Do you mean webui.call('ID') . then ((response) => { ... });

determining how many args we actually get called

Good idea, we should add this option.

expanding from click events to any eventListener event

Can you please clarify more this section?

executes a singular event at a time and with the locks

The old versions of webui does not use locks, so all UI events gets fired right away, but this caused many wrappers to crash, like the V wrapper for example. Also makes webui.call() start to miss some events when it get called quickly, like 100 times per second (every 10ms)... so, adding locks, and fire one event at a time solved all those issues. But I see your point, probably we should add an option to make events fired simultaneously, this can be handy for some projects.

binding functions into the global namespace in JS but they don't either

Normally, webui_bind("Bar") will create a DOM object in global namespace window, and it can be used simply by Bar();.

from webui.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.