mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2024-12-29 09:22:22 -05:00
emitter instances with base
This commit is contained in:
parent
33046fff47
commit
11f4fa49b0
1 changed files with 3 additions and 9 deletions
|
@ -12,14 +12,8 @@
|
|||
|
||||
module('Emitter');
|
||||
|
||||
function emitterFactory() {
|
||||
var emitter = {};
|
||||
paper.Base.each(Emitter, function (f, k) {emitter[k] = f});
|
||||
return emitter;
|
||||
}
|
||||
|
||||
test('on()', function() {
|
||||
var emitter = emitterFactory(),
|
||||
var emitter = new Base(Emitter),
|
||||
installed;
|
||||
// fake event type registration
|
||||
emitter._eventTypes = {mouseMove: {install: function(){ installed = true;} } };
|
||||
|
@ -43,7 +37,7 @@ test('on()', function() {
|
|||
});
|
||||
|
||||
test('off()', function() {
|
||||
var emitter = emitterFactory(),
|
||||
var emitter = new Base(Emitter),
|
||||
uninstalled, called = 0,
|
||||
handler = function () {called++},
|
||||
handler2 = function () {};
|
||||
|
@ -74,7 +68,7 @@ test('off()', function() {
|
|||
});
|
||||
|
||||
test('emit()', function() {
|
||||
var emitter = emitterFactory(),
|
||||
var emitter = new Base(Emitter),
|
||||
called,
|
||||
handler = function (e) {called = e};
|
||||
// fake event type registration
|
||||
|
|
Loading…
Reference in a new issue