Coder Social home page Coder Social logo

nodebind's Introduction

NodeBind

Analytics

nodebind's People

Contributors

arv avatar benogle avatar dfreedm avatar ebidel avatar igorminar avatar niflostancu avatar pflannery avatar rafaelw 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

Watchers

 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

nodebind's Issues

Just a question

What is a "prolyfill"? How much does it differ from a _poly_fill?

Storing number types

I'm finding that when I use the input type=number element I get strings instead of numbers.

I want to propose a change to at part of the code

to include this:

if (input.type==='number')
  observable.setValue(input.valueAsNumber);
else
  observable.setValue(input[property]);

This then stores the user input as a number type

Consider allowing select.value & option.value bound value to be object-valued

The idea here is that it's often useful to have a selector whose value is a domain object.

IOW

model = {
  users: [{ name: 'Bob', id: 1}, { name: 'Sally', id: 2}];
  selected: undefined
}
<select value={{ selected }}>
  <option template repeat="{{ user in users }}" value="{{ user }}">{{ user.name }}</option>
</select>

NodeBind should support binding to events

Polymer supports this following kind of thing:

<div on-click="{{ myClickHandler }}"></div>

It does this at the polymer-expressions layer. I think this is very common behavior and should be a concern of element's NodeBind.

Here's how I propose this work:

HTMLElement allows binding to 'on-', by setting up a binding to the event whose name is the first N non-whitespace characters following 'on-'. The behavior of the binding is to

addEventListener(name, function(e) { 
  var fn = observable.getValue();
  if (typeof fn == 'function')
    fn(e);
  else
    console.warn('cannot invoke non-function: ' + fn);
});

One thing to note here is that the bindingValue doesn't really need to be an observer, even though it is dynamic. It's sufficient to retrieve the value when the event is handled.

Thus the implementation of the element that handles the binding might not call open(), but only getValue() on the observable.

Looping over objects

As far as I can see it's not possible to loop over an object, despite this being extremely logical in certain cases (say we have a dedicated element showing a list of tests, document.getElementById('testList').tests.someTest.correct=0 would be a sensible interface, however this isn't really possible with the NodeBind setup right now (as far as I was able to find out)). Is there any specific reason this is not supported? Especially the in syntax suggests it should work, but at least on the stable version this doesn't seem to be working.

Just to be clear here, I talking about

<template repeat="{{a in b}}">
    c
</template>

where b is {a:'b',c:'d'}.

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.