Git Product home page Git Product logo

phosphor-application-markup's People

Contributors

quigleyj97 avatar

Stargazers

 avatar

Watchers

 avatar  avatar

phosphor-application-markup's Issues

Data Binding

My over-arching goal with this library is to achieve a full model-view-viewmodel framework that bolts onto Phosphor and the DOM. But what's missing right now are viewmodels and binding.

Consider in XAML, you have:

  • The View (written in XAML)
  • The Viewmodel (A code-behind associated with the XAML, written in a CLI language like C#)
  • The model (Any set of objects implementing INotifyPropertyChanged)

With this split, bindings can be expressed between the view (or viewmodel) and the model, without encumbering the model with the concerns of XAML-land.

I'm not sure this is possible to do so elegantly in JS, but that's not to say it isn't possible. I have a few mental models for this:

  1. Models must subclass some abstract NotifyPropertyChanged, and the framework will use that for binding sources
  2. Models must be passed through some proxy generator, that will create get/set wrappers around a set of properties to achieve the same effect as NotifyPropertyChanged
  3. Models must be immutable or observable

3 is the approach that React and various state stores (like Redux) take, while Angular takes a bit of a hybrid of 3 and a top-down change detector. I'm against the change detector path since it requires a leaky DX (developers must know the caveats to avoid them), and practically would require computationally intensive diffing.

I like the "easy" nature of 2 but it still feels "wrong" in some sense, that models (or their consumers) have to specify what to observe. This complicates dynamic bindings.

1 is, I think, the most straight-forward but rather alien to the front-end world. It also requires that models be written with that in mind- we can alleviate the concern with some fancy decorators but at the end of the day you still have to consume a library-specific class to make it work.

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.