Completed
Push — master ( 2c8d61...d12e3c )
by Yoh
48s
created

Event.target()   A

Complexity

Conditions 1

Size

Total Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
c 1
b 0
f 0
dl 0
loc 3
rs 10
1
module Hyalite
2
  module DOM
3
    module Event
4
      EVENT_CLASSES = {
5
        'click' => MouseEvent,
6
        'keydown' => KeyboardEvent
7
      }
8
9
      def self.create(event)
10
        type = `event.type`
11
        event_class = EVENT_CLASSES[type]
12
        if event_class
13
          event_class.new(event)
14
        end
15
      end
16
17
      def target
18
        Node.create(`self.native.target`)
19
      end
20
    end
21
  end
22
end
23