Skip to content

Commit

Permalink
Allow .ready() to be fired multiple times without adding lots of even…
Browse files Browse the repository at this point in the history
…t listeners
  • Loading branch information
jonathan-fielding committed Jun 23, 2014
1 parent 4af1e66 commit b15ee0b
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 11 deletions.
2 changes: 2 additions & 0 deletions README.md
Expand Up @@ -18,6 +18,8 @@ Documentation can be found at http://www.simplestatemanager.com

##Release Log

###2.2.6 - June 23, 2014
* Fixed issue where you can apply multiple readies.

###2.2.5 - June 12, 2014
* Fixed issue where it didnt work when you zoom the browser
Expand Down
2 changes: 1 addition & 1 deletion bower.json
@@ -1,6 +1,6 @@
{
"name": "SimpleStateManager",
"version": "2.2.5",
"version": "2.2.6",
"main": "src/ssm.js",
"ignore": [
"**/.*",
Expand Down
4 changes: 2 additions & 2 deletions dist/ssm.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 6 additions & 1 deletion index.html
Expand Up @@ -54,7 +54,7 @@
<div class="container">
<img src="docs/images/ssm-logo.png" class="logo">

<h1>Simple State Manager 2.2.5</h1>
<h1>Simple State Manager 2.2.6</h1>

<p class="lead">Simple State Manager (SSM for short) is a javascript state manager for responsive websites. It is built to be light weight, has no dependencies (except javascript of course) and aims to be really easy to simply drop into your project ready to use.</p>
<a class="btn btn-large btn-primary" href="https://github.com/jonathan-fielding/SimpleStateManager/archive/master.zip">Download</a>
Expand Down Expand Up @@ -321,6 +321,11 @@ <h2>Browser Support</h2>
<h2>Release Log</h2>
<p>SimpleStateManager follows <a href="http://semver.org/">Semantic Versioning 2.0.0</a></p>

<h3>2.2.6 - June 23, 2014</h3>
<ul>
<li>Fixed issue where you can apply multiple readies</li>
</ul>

<h3>2.2.5 - June 12, 2014</h3>
<ul>
<li>Fixed issue where it didnt work when you zoom the browser</li>
Expand Down
2 changes: 1 addition & 1 deletion package.json
@@ -1,7 +1,7 @@
{
"name": "SimpleStateManager",
"description": "SimpleStateManager ==================",
"version": "2.2.5",
"version": "2.2.6",
"main": "src/ssm.js",
"scripts": {
"test": "grunt travis --verbose"
Expand Down
17 changes: 11 additions & 6 deletions src/ssm.js
Expand Up @@ -3,7 +3,8 @@
;(function (window, document, undefined) {
"use strict";

var ssm = {},
var isReady = false,
ssm = {},
states = [],
browserWidth = 0,
currentStates = [],
Expand Down Expand Up @@ -254,11 +255,15 @@
//Update browser width
browserWidth = getWidth();

//Attach event for resizing
if (window.attachEvent) {
window.attachEvent("onresize", browserResizeDebounce);
} else if (window.addEventListener) {
window.addEventListener("resize", browserResizeDebounce, true);
if(isReady === false){
//Attach event for resizing
if (window.attachEvent) {
window.attachEvent("onresize", browserResizeDebounce);
} else if (window.addEventListener) {
window.addEventListener("resize", browserResizeDebounce, true);
}

isReady = true;
}

browserResize(browserWidth);
Expand Down

0 comments on commit b15ee0b

Please sign in to comment.