Skip to content

Commit

Permalink
Detachedcallback
Browse files Browse the repository at this point in the history
Remove resize-listener when detached
  • Loading branch information
erikwett committed Sep 14, 2015
1 parent d85c3d9 commit f561561
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 11 deletions.
3 changes: 1 addition & 2 deletions README.md
Expand Up @@ -44,8 +44,7 @@ Or [download as ZIP](https://github.com/erikwett/upper88-wordcloud/archive/maste

Attribute | Options | Default | Description
--- | --- | --- | ---
rows | *Array* | none | An array of arrays. First value in each array is the text,
| | | second is the value
rows | *Array* | none | An array of arrays. First value in each array is the text,second is the value
options | *Object* | | Options. Current options are: maxFont (default 24), minFont (default 12)


Expand Down
2 changes: 1 addition & 1 deletion bower.json
@@ -1,6 +1,6 @@
{
"name": "upper88-wordcloud",
"version": "0.1.0",
"version": "0.1.1",
"description": "Word Cloud Custom Element",
"license": "MIT",
"main": "upper88-wordcloud.html",
Expand Down
2 changes: 1 addition & 1 deletion index.html
Expand Up @@ -15,7 +15,7 @@
upper88-wordcloud {
height: 600px;
width: 80%;
background-color: lightgreen;
background-color: lightgray;
position:absolute;
border-color: black;
border-style: solid;
Expand Down
13 changes: 6 additions & 7 deletions upper88-wordcloud.html
Expand Up @@ -31,15 +31,14 @@

element.attachedCallback = function() {
var me = this;
window.addEventListener("resize", function() {
render(me);
});
setTimeout(function() {
render(me);
}, 100);
me.redraw = function(){render(me);};
window.addEventListener("resize", me.redraw);
setTimeout(me.redraw, 100);
};

element.detachedCallback = function() {};
element.detachedCallback = function() {
window.removeEventListener("resize",this.redraw);
}

element.attributeChangedCallback = function(attr, oldVal, newVal) {
render(this);
Expand Down

0 comments on commit f561561

Please sign in to comment.