Costa
Costa

Reputation: 654

How can I get current queue in emberJs?

tell me please, how can I debug queues in Ember.js and get current queue with "debugger;"?

Upvotes: 0

Views: 279

Answers (1)

Daniel
Daniel

Reputation: 18682

You can get current queue by inspecting:

Ember.run.currentRunLoop.queues

You'll notice you have many queues there:

Object {sync: Queue, actions: Queue, routerTransitions: Queue, render: Queue, afterRender: Queue…}

You have to expand each property which is a Queue, for example, actions and see if it has _queueBeingFlushed property defined. If yes, then it is current Queue.

Example of _queueBeingFlushed for actions Queue:

_queueBeingFlushed: Array[4]
0: null
1: ()
2: undefined
3: undefined
length: 4

When you know that you can also filter Ember.run.currentRunLoop.queues and get current Queue programatically.

developer tools

Upvotes: 2

Related Questions