dman
dman

Reputation: 11064

Polymer- add behavior without creating a custom element?

In Polymer 1.1, this is my index.html

 <template is="dom-bind" id="app">
      <paper-drawer-panel force-narrow id="the-drawer">
        <paper-header-panel drawer>
          <paper-toolbar></paper-toolbar>
            <div> Drawer content... </div>
        </paper-header-panel>
        <paper-header-panel shadow="true" 
          mode="waterfall-tall"
          main
          class="fit">
          <paper-toolbar>

I would like to add iron-resizable-behavior to catch resize events. The thing is, I don't want to make a custom element to do it. Is it possible to add iron-resizable-behavior to index.html without making a custom element?

Upvotes: 1

Views: 239

Answers (1)

Alan D&#225;valos
Alan D&#225;valos

Reputation: 2698

If you check the Behaviors guide, it mentions that the whole purpose for behaviors is for them to be extended by custom elements, so you can't use them without extending them in an element.

You could either create a simple element which extends iron-resizeable-behavior and fires events you can listen to or just make that entire dom-bind into an element.

Then again, depending on what you need to do, using iron-media-query might be enough.

Upvotes: 1

Related Questions