canjs / can-queues

A light weight JavaScript task queue
https://canjs.com/doc/can-queues.html
MIT License
2 stars 2 forks source link

logStack missing a task for a log #9

Closed JaneOri closed 5 years ago

JaneOri commented 7 years ago

In this example:

var stache = require("can-stache");
require("can-stache-bindings");
var queues = require("can-queues");

var CounterVM = DefineMap.extend("CounterVM",{
  count: {value: 0, type: "number"},
  add: function(){
    this.count++;
  }
});

var tempate = stache(`
      <span>{{count}}</span>
      <button on:click="add()">+1</button>
`);

var instance = new CounterVM();

window.queues = queues;
instance.on("count", function instanceCountChanged(){
    debugger;
})

//queues.log('flush')
document.body.appendChild(tempate(instance));

is not logging the "task":

queues.logStack()
can-log.js:102 INFO: NOTIFY ran task: CounterVM{}.add {context: undefined, args: Array(0), meta: {…}, fn: ƒ}args: []context: undefinedfn: ƒ ()meta: parentTask: nullreasonLog: (3) [button, MouseEvent, "on:click=add()"]stack: Queue {callbacks: {…}, name: "NOTIFY", index: 0, tasks: Array(0), _log: false}__proto__: Object__proto__: Object
can-log.js:102 INFO: MUTATE ran task: instanceCountChanged

INFO: MUTATE ran task: instanceCountChanged should have the task

justinbmeyer commented 6 years ago

I bet this is fixed now. Someone needs to verify again.

chasenlehara commented 5 years ago

@cherifGsoul Would you mind confirming whether this is still an issue please?

cherifGsoul commented 5 years ago

This is the console output:

MouseEvent {isTrusted: true, screenX: 41, screenY: 478, clientX: 41, clientY: 18, …} "on:click=add()"
MUTATE ran task: on:click="add()" {fn: ƒ, context: null, args: null, meta: {…}}args: nullcontext: nullfn: ƒ ()meta: {reasonLog: Array(3), parentTask: null, stack: Queue}__proto__: Object
MUTATE ran task: instanceCountChanged {fn: ƒ, context: CounterVM, args: Array(3), meta: {…}}
chasenlehara commented 5 years ago

Thanks Cherif, this looks fixed.