-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
glade ad element with a single gladeReady listener #2
base: master
Are you sure you want to change the base?
Conversation
LGTM |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
+bicknellr Hi Russell, in this PR there are two versions of the element: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've got a few comments but otherwise this looks good.
glade-ad-single-listener.html
Outdated
} | ||
</style> | ||
<div class="ad_slot_placeholder"></div> | ||
</div> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
extra </div>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oops; fixed.
glade-ad-single-listener.html
Outdated
</template> | ||
<script> | ||
(function() { | ||
var ad_slot; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think this is used anywhere.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Left over from playing :) Fixed.
glade-ad-single-listener.html
Outdated
properties: { | ||
adSlotId: { | ||
type: String, | ||
}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Properties that only specify type
have a shorthand form you can use if you want:
adSlotId: {type: String},
-> adSlotId: String,
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, much nicer!
glade-ad-single-listener.html
Outdated
}, | ||
|
||
observers: [ | ||
'propertiesChanged(adSlotId, dataAdUnitPath, width, height)' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
propertiesChanged
no longer exists, so I think you can remove this whole observers
list.
(tangent) If I remember correctly, all of the attributes will have been set to their respective properties by the time ready
is called. Given that a <glade-ad>
always waits until ready
before it attempts to run _load
(either running sync or inserting itself into the queue to be called later), all the properties should be available in time.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Got it; removing the observers list.
glade-ad-single-listener.html
Outdated
_load: function() { | ||
Polymer.RenderStatus.afterNextRender(this, function() { | ||
|
||
var ad_slot = Polymer.dom(this.root).querySelector(".ad_slot_placeholder"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you change <div class="ad_slot_placeholder"></div>
above to <div id="ad_slot_placeholder"></div>
(since you only have one), you can access it here as this.$.ad_slot_placeholder
. Polymer will find elements with ids in your template and add them as properties of this.$
automatically for you so you don't need to querySelector
manually.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nicer too :)
Thanks +bicknellr; we incorporated your recommendations. |
+demianrenzulli The component seems to be working nicely. Let's make some more tests to verify. Thanks! |
No description provided.