polymer does not bind from outside -
polymer does not bind from outside -
my-form
not iloadchanged
<my-form idb="{{idb}}" iload="{{iload}}"></my-form> <catalog-1 idb="{{idb}}"></catalog-1> <my-database idb="{{idb}}" iload="{{iload}}"></my-database>
but work when set my-database
within my-form
?
my-form
<polymer-element name="my-form" attributes="idb iload"> <template> ... <my-database idb="{{idb}}" iload="{{iload}}"></my-database> </template> <script> polymer('my-form', { iload:false, idb:null, iloadchanged:function(){ console.log('hello?') },
my-database
<polymer-element name="my-database" attributes="idb iload idrop"> <script> polymer('my-database', { idb:null, iload:false, ready:function(){ var load=function(){ this.iload=true console.log('iload',this.iload) }.bind(this) var request = indexeddb.open("my-database",1); request.onupgradeneeded = function(e) { var db = e.currenttarget.result var store = db.createobjectstore("store", {keypath: "muts", autoincrement:false}) //store.createindex("by_submit", "submit", {unique: false}) console.log('db upgrade', 'v'+db.version) } request.onerror = function(e) { //var db = e.currenttarget.result; //db.close() console.error('db error ',e) } request.onsuccess = function(e) { var db = e.currenttarget.result db.onversionchange = function(e) { db.close() console.log('db changed', 'v'+db.version, 'closed') } console.log('db setup', 'v'+db.version, 'ok') load() } this.idb=request }, idrop: function () { this.idb.result.close() var req = indexeddb.deletedatabase(this.idb.result.name); req.onsuccess = function() {console.log("deleted database successfully")} req.onerror = function() {console.log("couldn't delete database")} req.onblocked = function() {console.log("couldn't delete database due operation beingness blocked")} } }) </script> </polymer-element>
how can create work outside my-form
?
needed utilize polymer wrapper.
<polymer-element name="my-wrapper"> <my-form drawer idb="{{idb}}" iload="{{iload}}"></my-form> <catalog-1 main idb="{{idb}}" page="{{page}}" muts="{{muts}}"></catalog-1> <my-database idb="{{idb}}" iload="{{iload}}"></my-database> ...
polymer
Comments
Post a Comment