Experience-Monks / f1-dom

Create f1 ui with the dom
MIT License
12 stars 4 forks source link

Add in event handling #1

Closed mikkoh closed 8 years ago

mikkoh commented 9 years ago

Currently f1-dom exports an array of functions for handling different CSS properties:

https://github.com/Jam3/f1-dom/blob/master/index.js

f1-dom should instead export an object. This object should contain the same array but along with it functionality to handle adding and removing user interaction events.

So:

{
  properties: [], // functions to handle css properties

  add: {
    mouseDown: function( target, listener ) {

      // handle adding the listener to the target
    }
  },

  remove: {

    mouseDown: function( target, listener ) {

      // handle removing the listener from the target
    }  
  }
}

In reality though to ensure that people can keep their file size low for instance if they don't want to bring in all event handling these functions should live in folders.

So for instance:

index.js // main module which is exported
properties.js // an array of functions to handle different properties
------------------/properties
------------------------------------transformOrigin.js

------------------/add // a folder which will handle adding user interface events
------------------------------------mouseDown.js

------------------/remove // a folder which will handle removing user interface events
------------------------------------mouseDown.js