Closed adamvy-google closed 7 years ago
Consider this code
foam.CLASS({ name: 'Data', properties: [ 'id', 'name' ] }); var E = foam.mlang.ExpressionsSingleton.create(); var dao = foam.dao.EasyDAO.create({ of: 'Data', daoType: 'MDAO', seqNo: true }); var filtered = dao.where(E.EQ(Data.NAME, "hello")); filtered.on.put.sub(function(s, on, put, obj) { console.log("First listener: ", obj.id); }); filtered.on.put.sub(function(s, on, put, obj) { console.log("Second listener:", obj.id); }); dao.put(Data.create({ name: 'hello' }));
Each listener will actually be called twice. The output will be:
Second listener: 1 First listener: 1 Second listener: 1 First listener: 1
@kgrgreer
Consider this code
Each listener will actually be called twice. The output will be: