added option default values inheritin to browser...

Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
Alex A. Naanou 2015-05-18 03:34:15 +03:00
parent 5a8f676fbe
commit 17c4a906b3

View File

@ -55,9 +55,17 @@ var BrowserClassPrototype = {
var BrowserPrototype = { var BrowserPrototype = {
dom: null, dom: null,
// option defaults and doc...
//
// XXX add enable/disable filter option...
options: { options: {
//path: null, //path: null,
//show_path: null, //show_path: null,
// handle keys that are not bound...
//
// NOTE: to disable, set ot undefined.
logKeys: function(k){ window.DEBUG && console.log(k) },
}, },
// XXX this should prevent event handler deligation... // XXX this should prevent event handler deligation...
@ -385,12 +393,14 @@ var BrowserPrototype = {
isTraversable: null, isTraversable: null,
// XXX need to get a container.... // XXX need to get a container....
// XXX prepare/merge options...
// XXX setup instance events... // XXX setup instance events...
__init__: function(parent, options){ __init__: function(parent, options){
// XXX merge options... options = options || {}
// XXX
this.options = options // merge options...
var opts = Object.create(this.options)
Object.keys(options).forEach(function(n){ opts[n] = options[n] })
options = this.options = opts
// build the dom... // build the dom...
var dom = this.dom = this.constructor.make(options) var dom = this.dom = this.constructor.make(options)
@ -399,8 +409,7 @@ var BrowserPrototype = {
dom.keydown( dom.keydown(
keyboard.makeKeyboardHandler( keyboard.makeKeyboardHandler(
this.keyboard, this.keyboard,
// XXX options.logKeys,
function(k){ window.DEBUG && console.log(k) },
this)) this))
// attach to parent... // attach to parent...