olsonjeffery / zzz-old-sugs Goto Github PK
View Code? Open in Web Editor NEWSpiderMonkey-based JavaScript platform
License: Other
SpiderMonkey-based JavaScript platform
License: Other
network connection between two points.. should be abstracted away as much as possible from the js perspective .. need to support tcp and udp.. should probably just have one thread for all connections, for now (which means non-blocking sockets...)
.. i imagine it being something like..
.. mostly need to figure out a sane impl for handling the network side of things.. also want to abstract out the SFML impl.. threading and networking is nice.. but i want to run it headless on a system w/o graphics ..
instead of polluting the global object with a bunch of helper funcs to call down.. push it into a single object..
where do global helper funcs impl'd in js go? should they all be a part of $
?
push all of the JS code into an isolated class/cmd pattern type setup where we can spin up a new js environment with an arbitrary set of scripts to populate the env and then enter an event loop in the compartment..
the idea being that the multiple environments can be spun up, one per thread, with one (presumably on the main thread) handling the UI and IO from the player, with the backend running independantly on another thread and they pass messages via JSON (so no objects leaking between them, ie security by isolation).. networking would be a third thread but probably won't require a compartment, since it'll just be routing messages to/from the other two threads.. yeah.
impl:
introduce the concept of the Worker, which encapsulates a JSContext* and a global obj (so it's a js sandbox).. so far we have three specialized Worker types:
...
Since these Workers are now isolated, we need to push the messaging system down into native code and provide a means for them to send messages back and forth.
require()
that takes a path/module (adding js/coffee suffix optional).. and the loader will do logic to add .js/.coffee and do a __native_fileExists()
check until it finds a match then pass that path into the native engine to load..require()
exports
object being returnedrequire()
to use when trying to resolve a script location.. defaults should include the moduleDir
(provided in the config), as well as the location of sugs-root/jslib (relative to the cwd of the running process) .. only do searches for scripts in these directories (this is the paths
array passed in as part of config.js
I guess something rspec-like. sigh. dunno how I feel about nested contexts.
provide a CLI switch to run in "test mode".. so we can do something like
and some code
{when, before, after, it} = $.require "spec"
when "doing something fascinating" ->
result = 0
before ->
result = sut.gimmeFourtyTwo()
it "should have an interesting result" ->
result.shouldEqual 42
note, in the above example, monkey patching system primitives (number, string, etc) is implied... how/what this includes will be a world of fun to work through.
http://stackoverflow.com/questions/2627004/embedding-binary-blobs-using-gcc-mingw
is probably a good place to start.. want to have a "release" build that embeds all of the scripts (the "sugs stdlib" consisting of underscore, cs and the sugs scripts) as binary resources which are loaded, as needed, at startup time..
this should happen post-$.require() (gh-1) and should work transparently from a user code perspective, with the only difference being that their scripts are packaged as binary resources instead of being read from the file system...
use uglify.js for script minification, as well?
https://github.com/mishoo/UglifyJS
off the top of my head:
bool
vs SpiderMonkey JSBool
.. probably should standardize on the formerchar*
towards std::string
where possible...camelCase
(lose the box_car
)__native_
FunctionSpec
ClassDef
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.