Code Monkey home page Code Monkey logo

js-opc's People

Contributors

parshap avatar

Stargazers

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

Watchers

 avatar  avatar  avatar  avatar

js-opc's Issues

Browser tests fail

Heyo,

Buffer class is used in test.js which is not available in Browsers:

Uncaught TypeError: Buffer.alloc is not a function
    at getBuffer (test-bundle.js:11774)
    at module.exports (test-bundle.js:11774)
    at Test.<anonymous> (test-bundle.js:11788)
    at Test.bound [as _cb] (test-bundle.js:8090)
    at Test.run (test-bundle.js:8103)
    at Test.bound [as run] (test-bundle.js:8090)
    at next (test-bundle.js:7900)
    at test-bundle.js:5322
    at Array.forEach (<anonymous>)
    at MutationObserver.<anonymous> (test-bundle.js:5321)

some usage questions

(Posted here so others may find it and because it exceeds 140 charactersโ€ฆ)

Background: I am using opc in an app that controls 'sections' of pixels according to some configurable logic. I wrote a very simple/naive abstraction on top of it (1 section = 1 strand), and I am using that to get a feeling for how a higher-level OPC package could look (internally and externally).

So far, the prototype is working fine, but some questions arose from that:

  • Buffers: As in your example, I am simply looping over every pixel in a strand and set its color, even when I want to set them all to the same color. Is that the recommended way to do it or does it just make for a very simple example? (This question might make more sense in the context of the next one).
  • Coordination: A very general question, but maybe there is an easy answer: Do I have to care at all about coordinating all the calls I make to set pixels vs. when I write those pixels to the stream?
    To my surprise, it just worked; I would have expected issues when writing to 2 strands at the same time and writing a "half-finished" stream to the buffer. On the other hand with a local simulator everything is so fast that I might just not see any weird things going on. I have absolutely no intuition about this, so: should I coordinate inside the lib to not do any concurrent writes?
  • Callbacks: Another point where I might just be confused: Upon first look, I expected stream.writePixels to take a callback(err, res), but it doesn't. Is that because it wouldn't make sense conceptually or just because it wasn't needed till now?

All 3 questions can be summarised as "should I now take the time to learn more about buffers/net/streams or will it just be fine" ;)

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.