Skip to content
This repository was archived by the owner on Jul 5, 2023. It is now read-only.

Commit 9245300

Browse files
committed
Merge pull request #10 from scalyr/czerwin-integrate-pulls
Integrated pull requests from contributors naermarth and mtorromeo
2 parents 8ce4e82 + 430bc06 commit 9245300

File tree

4 files changed

+24
-14
lines changed

4 files changed

+24
-14
lines changed

scalyr.js

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
11
/**
2-
* @license scalyr v1.0.1
2+
* @license scalyr v1.0.2
33
* (c) 2013 Scalyr, Inc. http://scalyr.com
44
* License: MIT
55
*/
6+
7+
'use strict';
8+
69
// You may just depend on the 'sly' module to pull in all of the
710
// dependencies.
811
angular.module('sly', ['slyEvaluate', 'slyRepeat']);
@@ -587,8 +590,10 @@ defineScalyrAngularModule('slyRepeat', ['gatedScope'])
587590
// was first 10, then 5, we will end up with the last 5 elements in the previousElementBuffer.
588591
// We keep this in case the length increases again.
589592
var previousElementBuffer = [];
590-
591-
var deregisterCallback = $scope.$watchCollection(collectionExpr, function(collection) {
593+
594+
var deregisterCallback = $scope.$watchCollection(collectionExpr, function(collection) {
595+
if (!collection)
596+
return;
592597
if (!isArray(collection))
593598
throw Error("'collection' did not evaluate to an array. expression was " + collectionExpr);
594599
var originalPreviousElementsLength = previousElements.length;
@@ -714,12 +719,12 @@ defineScalyrAngularModule('slyRepeat', ['gatedScope'])
714719
defineScalyrAngularModule('gatedScope', [])
715720
.config(['$provide', function($provide) {
716721
// We use a decorator to override methods in $rootScope.
717-
$provide.decorator('$rootScope', ['$delegate', '$exceptionHandler',
722+
$provide.decorator('$rootScope', ['$delegate', '$exceptionHandler',
718723
function ($rootScope, $exceptionHandler) {
719724

720725
// Make a copy of $rootScope's original methods so that we can access
721726
// them to invoke super methods in the ones we override.
722-
scopePrototype = {};
727+
var scopePrototype = {};
723728
for (var key in $rootScope) {
724729
if (isFunction($rootScope[key]))
725730
scopePrototype[key] = $rootScope[key];
@@ -743,7 +748,7 @@ defineScalyrAngularModule('gatedScope', [])
743748
// Because of how scope.$new works, the returned result
744749
// should already have our new methods.
745750
var result = scopePrototype.$new.call(this, isolate);
746-
751+
747752
// We just have to do the work that normally a child class's
748753
// constructor would perform -- initializing our instance vars.
749754
result.$$gatingFunction = this.$$gatingFunction;
@@ -766,7 +771,7 @@ defineScalyrAngularModule('gatedScope', [])
766771
var watch, value,
767772
watchers,
768773
length,
769-
next, current = this, target = this,
774+
next, current = this, target = this, last,
770775
dirty = false;
771776

772777
do { // "traverse the scopes" loop

scripts/includeFiles/header.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
11
/**
2-
* @license scalyr v1.0.1
2+
* @license scalyr v1.0.2
33
* (c) 2013 Scalyr, Inc. http://scalyr.com
44
* License: MIT
55
*/
6+
7+
'use strict';
8+
69
// You may just depend on the 'sly' module to pull in all of the
710
// dependencies.
811
angular.module('sly', ['slyEvaluate', 'slyRepeat']);

src/js/directives/slyRepeat.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,10 @@ defineScalyrAngularModule('slyRepeat', ['gatedScope'])
7575
// was first 10, then 5, we will end up with the last 5 elements in the previousElementBuffer.
7676
// We keep this in case the length increases again.
7777
var previousElementBuffer = [];
78-
79-
var deregisterCallback = $scope.$watchCollection(collectionExpr, function(collection) {
78+
79+
var deregisterCallback = $scope.$watchCollection(collectionExpr, function(collection) {
80+
if (!collection)
81+
return;
8082
if (!isArray(collection))
8183
throw Error("'collection' did not evaluate to an array. expression was " + collectionExpr);
8284
var originalPreviousElementsLength = previousElements.length;

src/js/lib/gatedScope.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,12 @@
1616
defineScalyrAngularModule('gatedScope', [])
1717
.config(['$provide', function($provide) {
1818
// We use a decorator to override methods in $rootScope.
19-
$provide.decorator('$rootScope', ['$delegate', '$exceptionHandler',
19+
$provide.decorator('$rootScope', ['$delegate', '$exceptionHandler',
2020
function ($rootScope, $exceptionHandler) {
2121

2222
// Make a copy of $rootScope's original methods so that we can access
2323
// them to invoke super methods in the ones we override.
24-
scopePrototype = {};
24+
var scopePrototype = {};
2525
for (var key in $rootScope) {
2626
if (isFunction($rootScope[key]))
2727
scopePrototype[key] = $rootScope[key];
@@ -45,7 +45,7 @@ defineScalyrAngularModule('gatedScope', [])
4545
// Because of how scope.$new works, the returned result
4646
// should already have our new methods.
4747
var result = scopePrototype.$new.call(this, isolate);
48-
48+
4949
// We just have to do the work that normally a child class's
5050
// constructor would perform -- initializing our instance vars.
5151
result.$$gatingFunction = this.$$gatingFunction;
@@ -68,7 +68,7 @@ defineScalyrAngularModule('gatedScope', [])
6868
var watch, value,
6969
watchers,
7070
length,
71-
next, current = this, target = this,
71+
next, current = this, target = this, last,
7272
dirty = false;
7373

7474
do { // "traverse the scopes" loop

0 commit comments

Comments
 (0)