api-console-assets
Version:
This repo only exists to publish api console components to npm
55 lines (52 loc) • 1.55 kB
HTML
<!--
@license
Copyright 2017 Mulesoft.
All rights reserved.
-->
<link rel="import" href="../polymer/polymer.html">
<!--
@group Anypoint Elements
@element anypoint-hoverable-behavior
@demo demo/index.html
-->
<script>
window.Anypoint = window.Anypoint || {};
/**
* **Note:** This is closed software and you can't use it in your projects unless
* you are a Mulesoft employee working on internall project.
*
* Use `Anypoint.AnypointHoverableBehavior` to implement an element that can be hovered.
* The control will get a `hovered` attribute when it's hovered by the poiting devide.
*
* Be aware that mobile devices will not support hovering as desktop devices and behavior
* may vary depending on platform. You should use this as little as possible.
*
* @polymerBehavior Anypoint.AnypointHoverableBehavior
*/
Anypoint.AnypointHoverableBehavior = {
properties: {
/**
* Set to tru when the controll is currently being hovered.
*/
hovered: {
type: Boolean,
notify: true,
reflectToAttribute: true
}
},
listeners: {
'mouseover': '_onHover',
'mouseleave': '_onLeave'
},
// Set's the `hovered` attribute to true when handled.
_onHover: function() {
// wherever child element send this event it will be always somewhere inside this.
this.hovered = true;
},
// Updates `hovered` if the control is not hovered anymore.
_onLeave: function() {
// mouseleave is fired when the pointer has exited the element and all of its descendants
this.hovered = false;
}
};
</script>