Giter VIP home page Giter VIP logo

angular-immutable's People

Contributors

bendrucker avatar mgechev 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  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  avatar  avatar  avatar  avatar  avatar

angular-immutable's Issues

bad sourceURL

bad sourceURL

//# sourceURL=/Users/soocheng/Documents/angular-immutable/lib/immutable.js

controllerAs compatibility

This library is super useful. Thank you!

It would be great to have compatibility with controllerAs so that it isn't necessary to use $scope. Is this possible?

Warnings with latest Immutable.js

Hello.

I am following your blog post http://blog.mgechev.com/2015/03/02/immutability-in-angularjs-immutablejs/ and using the latest immutable.js - v3.7.6.

Running the first example that uses angular-immutable brings the following warning:

iterable.length has been deprecated, use iterable.size or iterable.count(). This warning will become a silent error in a future version. Error
    at List.Object.defineProperty.get (http://localhost:8080/node_modules/immutable/dist/immutable.js:4650:21)
    at isArrayLike (http://localhost:8080/node_modules/angular/angular.js:282:46)
    at $watchCollectionInterceptor (http://localhost:8080/node_modules/angular/angular.js:16192:22)
    at Object.regularInterceptedExpression (http://localhost:8080/node_modules/angular/angular.js:14949:16)
    at Scope.$digest (http://localhost:8080/node_modules/angular/angular.js:16390:40)
    at Scope.$apply (http://localhost:8080/node_modules/angular/angular.js:16662:24)
    at bootstrapApply (http://localhost:8080/node_modules/angular/angular.js:1679:15)
    at Object.invoke (http://localhost:8080/node_modules/angular/angular.js:4657:17)
    at doBootstrap (http://localhost:8080/node_modules/angular/angular.js:1677:14)
    at Object.bootstrap (http://localhost:8080/node_modules/angular/angular.js:1697:12)

Although it's a warning, I wanted to point this out.

Thank you.

No use case for this filter

Hi Minko

I am following up from my comments on your excellent blog series about using immutables with angular.

Given the current implementation of immutable.js and angular, I don't see how any performance benefit can be realized from the immutable filter in this repo. I understand there is performance benefit when using immutables as the expr in a $watch(expr, listener, false), due to the fast reference checking.

But the point of this filter is to return an equivalent native datastrucutre from the immutable using the toJS() method. The object returned is always a new object. Because of this, if we were to use this filter in an expr to $watch(expr, listener, false), we would get many false positives and redundant invocations of listener (as you know the $digest is constantly running and evaluating expr even when expr isn't changing).

If used with $watchCollection, such as in <li ng-repeat="item in list | immutable">, we get no performance benefit as watchCollection doesn't compare references, but always looks for changes in the collection regardless.

In fact, using this filter can only degrade performance, because of the garbage collection overhead you describe in your blog.

Please correct me if I'm understanding this wrong, and thanks for the research.
Matt

controllerAs syntax support

Hi,

There seems to be no support for controllerAs syntax. It there any planned support for controllerAs syntax ?

I have been experimenting with your directive and these 2 functions, but with any solid result yet.

function getPropertyByPath(obj, path) {
  var i, j, parent, ref;
  path = path.split('.');
  parent = obj;
  if (path.length > 1) {
    for (i = j = 0, ref = path.length - 2; 0 <= ref ? j <= ref : j >= ref; i = 0 <= ref ? ++j : --j) {
      parent = parent[path[i]];
    }
  }
  return parent != null ? parent[path[path.length - 1]] : void 0;
}

function setPropertyByPath(obj, path, value) {
  var i, j, name, parent, ref;
  path = path.split('.');
  parent = obj;
  if (path.length > 1) {
    for (i = j = 0, ref = path.length - 2; 0 <= ref ? j <= ref : j >= ref; i = 0 <= ref ? ++j : --j) {
      parent = (parent[name = path[i]] || (parent[name] = {}));
    }
  }
  return parent[path[path.length - 1]] = value;
}

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.