Git Product home page Git Product logo

scoped-propagators's Introduction

scoped proagators

"Scoped propagators" are formed of a scope and a propagator which often looks like this:

click { text: "foo" }

The scope sets the events that cause propagation, such as clicks, ticks, or shape changes (not adding a scope will default to shape changes).

The propagator is a JS object (or function which returns one) that is applied to the shape.

Notes

  • shapes are passed both from and to shapes.
  • Shapes are flattened before being passed to the propagator, and unpacked on the other side. So properties live alongside the x, y, and rotation values (e.g. { x: 100, y: 100, text: "foo" }).

Current Issues (probably should be fixed before putting out a demo):

  • cycles of change propagators cause infinite recursion.
  • geo scopes are currently fired for any shape change, this should be localised to spatially local changes.

Effects / Generic JS

You can create effects or run arbitrary JS code if you use the full function syntax:

click () { return { text: "foo" } }

This can be useful for larger propagators, or for doing arbitrary stuff with the editor.

scoped-propagators's People

Contributors

orionreed avatar

Stargazers

David Thompson avatar  avatar  avatar Harrison Chin avatar Márk Bartos avatar  avatar Lulzx avatar

Watchers

 avatar

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.