Skip to content
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

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

amedina
Copy link
Collaborator

@amedina amedina commented Sep 8, 2017

No description provided.

@demianrenzulli
Copy link
Owner

LGTM

Copy link
Owner

@demianrenzulli demianrenzulli left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@amedina
Copy link
Collaborator Author

amedina commented Sep 8, 2017

+bicknellr Hi Russell, in this PR there are two versions of the element: glade-ad.html and glade-ad-single-listener.html. The first one adds one listener per element, and the second one implements the push mechanism we discussed yesterday. WDYT?

Copy link

@bicknellr bicknellr left a 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.

}
</style>
<div class="ad_slot_placeholder"></div>
</div>

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

extra </div>

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oops; fixed.

</template>
<script>
(function() {
var ad_slot;

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.

Copy link
Collaborator Author

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.

properties: {
adSlotId: {
type: String,
},

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,

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, much nicer!

},

observers: [
'propertiesChanged(adSlotId, dataAdUnitPath, width, height)'

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.

Copy link
Collaborator Author

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.

_load: function() {
Polymer.RenderStatus.afterNextRender(this, function() {

var ad_slot = Polymer.dom(this.root).querySelector(".ad_slot_placeholder");

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.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nicer too :)

@amedina
Copy link
Collaborator Author

amedina commented Sep 8, 2017

Thanks +bicknellr; we incorporated your recommendations.

@amedina
Copy link
Collaborator Author

amedina commented Sep 8, 2017

+demianrenzulli The component seems to be working nicely. Let's make some more tests to verify. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants