wire.js destroy context

49 views
Skip to first unread message

Peter Mucha

unread,
Jul 11, 2013, 4:48:28 PM7/11/13
to cuj...@googlegroups.com
i am currently updating my wire.js plugin from wire.js 0.9.1 to 0.10.0  and for test purposes, i was using this code:

wire(spec, {require:require}).then(function(ctx){
                        //get a bean
ctx.destroy();
//assert something on the bean
}, console.error);

this code was depending on the behaviour that ctx.destroy was triggering the destroy-listeners of the plugins. this does not seem to be the case anymore. is there some other possibility to unit-test destroy-listeners?

regards, peter

Brian Cavalier

unread,
Jul 12, 2013, 9:38:22 PM7/12/13
to cuj...@googlegroups.com
Hey Peter,

I've been heads-down this week working on a few things, so I didn't have time to look into this, but there were some changes to plugin architecture in 0.10 around context listeners.

Quick question: context.destroy() returns a promise, and so you need to wait for that promise to really make any assertions about the state of the context during or after the destroy process.  For example:

var destroyPromise = ctx.destroy();
// The context has not been destroyed here

destroyPromise.then(function() {
  // Now it has been destroyed
});

I should have time to look into this on Monday.  In the meantime, could you please open a github issue for this and if you have any more info, add it there.  Thanks!

--
You received this message because you are subscribed to the Google Groups "cujojs" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cujojs+un...@googlegroups.com.
To post to this group, send email to cuj...@googlegroups.com.
Visit this group at http://groups.google.com/group/cujojs.
To view this discussion on the web visit https://groups.google.com/d/msgid/cujojs/061dba6d-898c-4b5b-a26c-278ae5be1aff%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Peter Mucha

unread,
Jul 15, 2013, 11:12:09 AM7/15/13
to cuj...@googlegroups.com
hey, brian,
i tested with your code but it also did not work correctly.

i created an issue:
https://github.com/cujojs/wire/issues/122

regards, Peter
Reply all
Reply to author
Forward
0 new messages