Skip to content
This repository has been archived by the owner on Dec 30, 2018. It is now read-only.

Commit

Permalink
v0.3.1
Browse files Browse the repository at this point in the history
  • Loading branch information
passy committed Aug 4, 2013
1 parent 0fad655 commit 65a98af
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 10 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.md
@@ -1,3 +1,11 @@
<a name="v0.3.1"></a>
### v0.3.1 (2013-08-04)


#### Features

* **app:** expose scheduleMasonry(Once) methods ([0fad6552](http://github.com/passy/angular-masonry/commit/0fad65527af6f1dd11ebc2b3bb2deb03ebaef34c))

<a name="v0.3.0"></a>
## v0.3.0 (2013-08-04)

Expand Down
13 changes: 7 additions & 6 deletions angular-masonry.js
@@ -1,5 +1,5 @@
/*!
* angular-masonry 0.3.0
* angular-masonry 0.3.1
* Pascal Hartig, weluse GmbH, http://weluse.de/
* License: MIT
*/
Expand All @@ -11,22 +11,23 @@
var bricks = {};
var schedule = [];
var destroyed = false;
var self = this;
var timeout = null;

function scheduleMasonryOnce() {
this.scheduleMasonryOnce = function scheduleMasonryOnce() {
var args = arguments;
var found = schedule.filter(function (item) {
return item[0] === args[0];
}).length > 0;

if (!found) {
scheduleMasonry.apply(null, arguments);
this.scheduleMasonry.apply(null, arguments);
}
}

// Make sure it's only executed once within a reasonable time-frame in
// case multiple elements are removed or added at once.
function scheduleMasonry() {
this.scheduleMasonry = function scheduleMasonry() {
if (timeout) {
$timeout.cancel(timeout);
}
Expand Down Expand Up @@ -68,7 +69,7 @@
// Keep track of added elements.
bricks[id] = true;
$element.masonry('appended', element, true);
scheduleMasonryOnce('layout');
self.scheduleMasonryOnce('layout');
}
}

Expand All @@ -82,7 +83,7 @@

delete bricks[id];
$element.masonry('remove', element);
scheduleMasonryOnce('layout');
this.scheduleMasonryOnce('layout');
};

this.destroy = function destroy() {
Expand Down
4 changes: 2 additions & 2 deletions angular-masonry.min.js

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

2 changes: 1 addition & 1 deletion bower.json
@@ -1,7 +1,7 @@
{
"name": "angular-masonry",
"description": "An AngularJS directive for Masonry.",
"version": "0.3.0",
"version": "0.3.1",
"main": "./angular-masonry.js",
"ignore": [
"**/.*",
Expand Down
2 changes: 1 addition & 1 deletion package.json
@@ -1,6 +1,6 @@
{
"name": "angular-masonry",
"version": "0.3.0",
"version": "0.3.1",
"devDependencies": {
"grunt-contrib-uglify": "~0.2.2",
"grunt": "~0.4.1",
Expand Down

0 comments on commit 65a98af

Please sign in to comment.