Skip to content

Releases: canjs/can-observable-array

Organize tests for CanJS production tests

24 Jun 17:48
Compare
Choose a tag to compare

Remove the class fields test files to make tests production build for canjs/canjs suite.

Add babel plugin-proposal-class-properties plugin

22 Jun 19:08
Compare
Choose a tag to compare

propertyDefaults for observable class fields

18 Jun 17:38
Compare
Choose a tag to compare

Adds propertyDefaults support to observable class fields

class MyArray extends ObservableArray {

  foo = 4;

  static get propertyDefaults() {
    return type.maybeConvert(String);
  }
}

const anArray = new MyArray();

console.log(anArray.foo); // '4'

anArray.on('foo', (ev, newVal, oldVal) => {
  console.log(newVal); // -> '10'
});

anArray.set(foo, 10);

#85

Fix expando set

16 Jun 19:57
Compare
Choose a tag to compare

ObservableArray.prototype.set should not throw error:

class Foo extends ObservableArray{}
const foo = new Foo();
foo.set("count", 3);

#84

Observable class fields support

11 Jun 18:02
Compare
Choose a tag to compare
  • Adds observable class fields support:
class Person extends ObservableArray{
		greetings = 'Hello';
}

const cherif = new Person();

cherif.on('greetings', function (ev, newVal, oldVal) {
	    // it should be observable, handle change here
});

// Property change trigger the handler
cherif.greetings = 'Hola';
  • Observable class fields support documentation
    #78

Fix patches dispatched after mutate methods

22 May 21:04
Compare
Choose a tag to compare
const myList = new ObservableArray([0,1]);
myList.push("I am going to hide some changes.");
		
canReflect.onPatches(myList, function (patches) {
    console.log(patches[0].insert[0]);   // -> 'Patched after push'
});
	
myList[1] = "Patched after push";

#81

Dispatch patches for item mutation with 0 value

19 May 22:14
Compare
Choose a tag to compare

This fixes event dispatching when an item gets mutated with 0 integer value:

const order = new ObservableArray([0, 1]);
canReflect.onPatches(order, (patches) => {
       console.log(order[1]); // -> 0
});
order[1] = 0;

#80

Update listening to event documentation

12 Mar 15:51
Compare
Choose a tag to compare

Fix listening to event documentation.

#77

making sure dispatched patches have correct deleteCount

20 Nov 15:04
Compare
Choose a tag to compare

Dispatch converted items in patch inserts

19 Nov 17:31
Compare
Choose a tag to compare

Prior to this release, listening onPatches on an ObservableArray would send the original objects that were supplied to push/unshift/splice, even if those objects were converted to an items type when added to the array.

With this release, the patch listener receives the converted object instead. This resolves some unexpected behavior when building a view based on an ObservableArray in can-view-live.

#73 for more.