Coder Social home page Coder Social logo

weaver's People

Contributors

indus avatar maxkfranz avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

weaver's Issues

Error Attempting fabric.require with Plain JS Object with string field

When I attempt to pass in a js object to my fabric, I am given the following error:

obj["url"] = JSON.parse(""www.test.com"");
                        ^^

SyntaxError: missing ) after argument list
    at process.<anonymous> (.../weaverjs/dist/thread-node-fork.js:61:12)
    at emitTwo (events.js:87:13)
    at process.emit (events.js:172:7)
    at handleMessage (internal/child_process.js:686:10)
    at Pipe.channel.onread (internal/child_process.js:440:11)
undefined:3

See code below

  return f.require({url: url}, 'obj').pass(dataToSync).spread(sliceToSync => {

    var obj = _ref_('obj');

    var message = {};
    message.payload = sliceToSync;

    console.log(`syncing to `, obj);

    return JSON.stringify(message);
  }).then(res => {

    console.log('res is ' + res);
    f.stop();
    return res;
  });

Duplicate: prototype of undefined

Edit: Didn't mean to close!

To give more context, I copied this from the docs:

function foo(){
  return 'bar';
}

var t = weaver.thread();

t.require( foo, 'foo' ); // explicitly specify name to avoid minification issues

t.run(function(){
   // explicitly get by reference to avoid minification issues:
  var foo = _ref_('foo');
  var resolve = _ref_('resolve');

  resolve( foo() );
}).then(function( val ){
  console.log( val ); // bar
});

I attempt to run this code from a meteor method or from inside meteor.startup

Throw errors

The errors we have aren't conducive to continuing to run afterwards, so throwing would be better.

Fallback without threading

For systems without threading systems (like many versions of IE), fall back on running the same API in the main thread.

fabric.spreadOneByOne()

fabric.spread() simply splits the array of data between the threads. Sometimes you have an array that contains items of varying processing expense.

Using fabric.pass( array.sort( byExpense ) ).spreadOneByOne( ... ), the items in the sorted array will be divvied up one by one, alternating the owning thread. In this way, the processing expense is more evenly distributed among the threads -- thereby increasing performance.

Provide full working demo examples?

Great project. IMHO, full working examples are always useful to have, especially as boilerplate. This includes some ideas on "what can I build with weaverjs." An example of some useful things to have might be:

  • data fetching (parallelize HTTP requests to download x)
  • performance testing (a mini clone of JSperf.com)
  • image processing

etc.

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.