Code Monkey home page Code Monkey logo

Comments (7)

almarklein avatar almarklein commented on August 16, 2024

(this might be a possible approach for Bokeh to do its widgets)

from flexx.

almarklein avatar almarklein commented on August 16, 2024

There has been an occurance where Chrome would block JS in a flexx app, probably because of the eval that we use. Using a formalized protocol should get rid of that.

from flexx.

almarklein avatar almarklein commented on August 16, 2024

mmm... now that I think of it, that's not entirely true. Model classes that are defined after the page has been served will be dynamically defined, using eval. Well, at least eval would be used way less.

from flexx.

almarklein avatar almarklein commented on August 16, 2024

Related to #143

from flexx.

almarklein avatar almarklein commented on August 16, 2024

Mmm, it seems that eval() would be a good way to load modules dynamically, and still have them show up as "files" in the debugger, using //# sourceURL=hello.js.

Eval is not necesarily evil, as long as you do it in a way that does not allow misuse. Since the server sends the source over a websocket, I don't think this is a problem. Arguments about performance don't matter these days.

We might want to look at https://developer.chrome.com/extensions/contentSecurityPolicy to prevent the Chrome browser from blocking eval, though.

from flexx.

Korijn avatar Korijn commented on August 16, 2024

Did you also see this variant on the same scheme? Serving a JS file that has //@ sourceURL=foo.js at the beginning will also show it in the devtools.

http://stackoverflow.com/a/18007439/552379

from flexx.

almarklein avatar almarklein commented on August 16, 2024

Had a look at the protocol during some of the late app refactoring. Most commands consist of a command and then a string. There are a few exceptions of commands that have more "arguments", but they can safely be space-splitted. Commands that are just strings also have advantages, e.g. in exported notebooks. Therefore, I chose to leave it as is. The commands can still be formalized, though I don't think there is much need while its only our Py and our JS talking to eachother.

from flexx.

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.