GithubHelp home page GithubHelp logo

Comments (6)

kltm avatar kltm commented on July 24, 2024

http://wiki.commonjs.org/wiki/CommonJS

from bbop-js.

kltm avatar kltm commented on July 24, 2024

A slightly hybrid style seems to work (contrib/commonjs), but given the amount of interconnectedness at the core, will have to commit more fully to work it out. Branch for "issue20".
This will necessarily change the testing and inclusion workflows a bit, but should greatly simplify scripting and cross-platform usability.

from bbop-js.

kltm avatar kltm commented on July 24, 2024

Pretty much done and pushed. Still looking at some of the console script examples.

from bbop-js.

kltm avatar kltm commented on July 24, 2024

A little public explanation for the way I did it from my notes:
---
just to clarify the rational for:
var bbop = require('bbop').bbop;
instead of the more common (and correct?)
var bbop = require('bbop');
1) if bundle bbop.js in with amigo.js, we could then have:
var bbop = require('amigo').bbop;
or something
2) more importantly, the exports assumption in the typical server/common environment
would want us to write our code like
---
exports.core.chop = function(x,y,z){ ... };
...
return exports;
...
---
that would allow us to do it the expected way on the server,
but it would introduce a lot of browser-side issues with
namespaces when it came to amigo and bbop playing together, etc.
and more overhead in dealing with that (external libs, etc.)
so we have a hybrid solution which should technically be
commonjs modules 1.0, but still tries to behave like normal
browser JS. This is only possible because we build single files
instead of having interdependent modules in different files

from bbop-js.

kltm avatar kltm commented on July 24, 2024

Appropriate changes made to the amigo JS libraries as well.

from bbop-js.

kltm avatar kltm commented on July 24, 2024

The server side stuff has proved to work a lot more sensibly, and node no longer needs a wrapper runner to create the environment. Done then (although a lot of the scripts will remain borked until I freshen them at some point).

from bbop-js.

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.