Giter Club home page Giter Club logo

polychrome's Introduction

PolyChrome

PolyChrome is an extension for Firefox web browser that can run SML programs embedded in HTML documents. The extension provides a simple foreign function interface to JavaScript. As a result, JavaScript libraries and interfaces provided by the browser, such as DOM and Canvas, can be used in SML.

Running the extension with the deploy script

  • Create a deploy.cfg file based on the deploy.cfg.template

  • Executing

    ./deploy

    will place a text file in your Firefox profile with the path to the source code of the extension. The deploy script also clears the cache/registry of the extensions (which is not that important in most cases). Execute

    ./deploy run

    to immediately run Firefox (with the error console opened) after deploying the extension.

Documentation

http://kidkarolis.github.com/PolyChrome/

polychrome's People

Contributors

kidkarolis avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

Forkers

akissinger

polychrome's Issues

Polish the jsffi structure

#1

use more types, e.g.

    val exec_js_r : string -> string -> JSON.T list list -> string

should be

    val exec_js_r : fptr -> string -> arg list -> string

#2

The getter

    val exec_js_get : string -> string -> JSON.T list list -> string

should be

    val exec_js_get : fptr -> string -> string

Documentation navigation styling bug

Resize browser so that a horizontal scrollbar appears. When scrolling, the navigation goes on top of the content.

The simplest fix would be setting navigation's background:white.

need to detect incorrect paths for SML script

<script type="application/x-polyml" src="no_such_ml_file.sml"></script>

Gives lots of spurious errors if the file "no_such_ml_file.sml" does not exist. We should detect if the file doesn't exist (404 messages), and give a sensible error.

Improvements to Console

TODO

  • better editing of multiline commands
  • Autocomplete
  • a separate thread for console?

SOME PROGRESS

  • styling and coloring of the messages (chrome style)

COMPLETE

  • adjusting height of the logArea when change the size of the console
  • tab and window madness (e.g. when two windows are opened the console breaks) (see https://developer.mozilla.org/en/Code_snippets/Tabbed_browser) (except the dragging of the tabs)
  • Always on / Always off settings
  • History of entered commands
  • Style of the disable button

Multiple pop-up windows for starting PolyChrome

Multiple clicks on the polychrome icon (at the bottom-right), to start a polyml console, opens up multiple-pop-up windows asking if you want to open the console. We should only open up one however many times that icon is clicked.

Full PolyML JSON library

Would be nice to have a complete JSON library. Could be reused in many other projects. It's not that big so it shouldn't be hard to fully implement it.

It could then be used in parsing messages from Firefox and event data. Also for example for jQuery function parameters (e.g. jQuery.ajax({type:GET, url:www});

Implement nsIScriptRuntime for handling scripts in the HTML

This would be a more direct way of executing PolyML script tags. Firefox would ask our XPCOM component to execute the code every time it finds a script tag. This way you wouldn't need to reread the page after it has loaded.

On the other hand, this is also too Firefox specific and it might actually slow down the rendering of the page.

A better type conversion between Poly and JavaScript

For example, currently, all values sent to Poly as part of a foreign function call are strings. Every function using jsffi.exec_js... has to convert those strings into appropriate types. Which is also not that nice, because currently there is no guarantee that for example a string received from JavaScript can always be parsed into an Integer etc.
Additional dirty bit is a similar function Memory.convertArgsToPoly, which is used in Poly callbacks, where strings like "some_function arg1 arg2 arg3" are formed from javascript variables. Similarly to before, there is currently no guarantee that the number of arguments to the functions is going to be the same all the time or that those times are always gonna be the same. For example, if function "some_function" is of type int -> int -> string -> unit, we can't guarantee that the first argument in javascript function call will be smth that can be parsed into int.

Rewrite the callback handlers in a more universal manner

Currently, to enable callback handlers, one has to define a table to store the handlers and then define special handling functions that can call functions from that table. Try to implement this in jsffi in a more universal way, to allow for adding callbacks like this:
exec_js ojb "drag" [args.callback f, args.callback b]

can't use JavaScript new operator from sml

a workaround is to create a wrapper function in the html doc like
fun newSomething() {
return new Someting();
}
and calling this wrapper function from sml
exec_js_call "newSomething"

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.