Skip to content
This repository was archived by the owner on Mar 8, 2021. It is now read-only.

Commit c9cafdd

Browse files
committed
adding missing docblocks and tiny tweak
1 parent 509d216 commit c9cafdd

File tree

6 files changed

+62
-28
lines changed

6 files changed

+62
-28
lines changed

bower.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "angular-locker",
3-
"version": "1.2.0",
3+
"version": "1.2.1",
44
"homepage": "https://github.com/tymondesigns/angular-locker",
55
"authors": [
66
"Sean Tymon <tymon148@gmail.com>"

dist/angular-locker.js

Lines changed: 29 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@
5959
};
6060

6161
/**
62-
* Set the default driver and namespace
62+
* Set the defaults
6363
*
6464
* @type {Object}
6565
*/
@@ -76,7 +76,8 @@
7676
* Allow setting of default storage driver via `lockerProvider`
7777
* e.g. lockerProvider.setDefaultDriver('session');
7878
*
79-
* @param {String} driver
79+
* @param {String|Function} driver
80+
* @return {self}
8081
*/
8182
setDefaultDriver: function (driver) {
8283
defaults.driver = _value(driver);
@@ -86,6 +87,8 @@
8687

8788
/**
8889
* Get the default driver
90+
*
91+
* @return {String}
8992
*/
9093
getDefaultDriver: function () {
9194
return defaults.driver;
@@ -95,7 +98,8 @@
9598
* Allow setting of default namespace via `lockerProvider`
9699
* e.g. lockerProvider.setDefaultNamespace('myAppName');
97100
*
98-
* @param {String} namespace
101+
* @param {String|Function} namespace
102+
* @return {self}
99103
*/
100104
setDefaultNamespace: function (namespace) {
101105
defaults.namespace = _value(namespace);
@@ -105,6 +109,8 @@
105109

106110
/**
107111
* Get the default namespace
112+
*
113+
* @return {String}
108114
*/
109115
getDefaultNamespace: function () {
110116
return defaults.namespace;
@@ -113,7 +119,8 @@
113119
/**
114120
* Set whether the events are enabled
115121
*
116-
* @param {Boolean} enabled
122+
* @param {Boolean|Function} enabled
123+
* @return {self}
117124
*/
118125
setEventsEnabled: function (enabled) {
119126
defaults.eventsEnabled = _value(enabled);
@@ -123,6 +130,8 @@
123130

124131
/**
125132
* Get whether the events are enabled
133+
*
134+
* @return {Boolean}
126135
*/
127136
getEventsEnabled: function () {
128137
return defaults.eventsEnabled;
@@ -131,7 +140,8 @@
131140
/**
132141
* Set the separator to use with namespace in keys
133142
*
134-
* @param {String} separator
143+
* @param {String|Function} separator
144+
* @return {self}
135145
*/
136146
setSeparator: function (separator) {
137147
defaults.separator = _value(separator);
@@ -141,6 +151,8 @@
141151

142152
/**
143153
* Get the separator
154+
*
155+
* @return {String}
144156
*/
145157
getSeparator: function () {
146158
return defaults.separator;
@@ -160,6 +172,8 @@
160172
function Locker (driver, namespace) {
161173

162174
/**
175+
* Out of the box drivers
176+
*
163177
* @type {Object}
164178
*/
165179
this._registeredDrivers = {
@@ -281,8 +295,8 @@
281295
/**
282296
* Trigger an event
283297
*
284-
* @param {String} name
285-
* @param {Object} payload
298+
* @param {String} name
299+
* @param {Object} payload
286300
* @return {void}
287301
*/
288302
this._event = function (name, payload) {
@@ -473,7 +487,7 @@
473487
},
474488

475489
/**
476-
* Return all items in storage within the current namespace
490+
* Return all items in storage within the current namespace/driver
477491
*
478492
* @return {Object}
479493
*/
@@ -492,7 +506,7 @@
492506
},
493507

494508
/**
495-
* Remove all items set within the current namespace
509+
* Remove all items set within the current namespace/driver
496510
*
497511
* @return {self}
498512
*/
@@ -554,10 +568,13 @@
554568
unbind: function ($scope, key) {
555569
$parse(key).assign($scope, void 0);
556570
this.forget(key);
557-
if (this._watchers[key + $scope.$id]) {
571+
572+
var watchId = key + $scope.$id;
573+
574+
if (this._watchers[watchId]) {
558575
// execute the de-registration function
559-
this._watchers[key + $scope.$id]();
560-
delete this._watchers[key + $scope.$id];
576+
this._watchers[watchId]();
577+
delete this._watchers[watchId];
561578
}
562579

563580
return this;

dist/angular-locker.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/angular-locker.min.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "angular-locker",
3-
"version": "1.2.0",
3+
"version": "1.2.1",
44
"description": "A simple & configurable abstraction for local/session storage in angular projects",
55
"author": "@tymondesigns",
66
"license": "MIT",

src/angular-locker.js

Lines changed: 29 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@
5959
};
6060

6161
/**
62-
* Set the default driver and namespace
62+
* Set the defaults
6363
*
6464
* @type {Object}
6565
*/
@@ -76,7 +76,8 @@
7676
* Allow setting of default storage driver via `lockerProvider`
7777
* e.g. lockerProvider.setDefaultDriver('session');
7878
*
79-
* @param {String} driver
79+
* @param {String|Function} driver
80+
* @return {self}
8081
*/
8182
setDefaultDriver: function (driver) {
8283
defaults.driver = _value(driver);
@@ -86,6 +87,8 @@
8687

8788
/**
8889
* Get the default driver
90+
*
91+
* @return {String}
8992
*/
9093
getDefaultDriver: function () {
9194
return defaults.driver;
@@ -95,7 +98,8 @@
9598
* Allow setting of default namespace via `lockerProvider`
9699
* e.g. lockerProvider.setDefaultNamespace('myAppName');
97100
*
98-
* @param {String} namespace
101+
* @param {String|Function} namespace
102+
* @return {self}
99103
*/
100104
setDefaultNamespace: function (namespace) {
101105
defaults.namespace = _value(namespace);
@@ -105,6 +109,8 @@
105109

106110
/**
107111
* Get the default namespace
112+
*
113+
* @return {String}
108114
*/
109115
getDefaultNamespace: function () {
110116
return defaults.namespace;
@@ -113,7 +119,8 @@
113119
/**
114120
* Set whether the events are enabled
115121
*
116-
* @param {Boolean} enabled
122+
* @param {Boolean|Function} enabled
123+
* @return {self}
117124
*/
118125
setEventsEnabled: function (enabled) {
119126
defaults.eventsEnabled = _value(enabled);
@@ -123,6 +130,8 @@
123130

124131
/**
125132
* Get whether the events are enabled
133+
*
134+
* @return {Boolean}
126135
*/
127136
getEventsEnabled: function () {
128137
return defaults.eventsEnabled;
@@ -131,7 +140,8 @@
131140
/**
132141
* Set the separator to use with namespace in keys
133142
*
134-
* @param {String} separator
143+
* @param {String|Function} separator
144+
* @return {self}
135145
*/
136146
setSeparator: function (separator) {
137147
defaults.separator = _value(separator);
@@ -141,6 +151,8 @@
141151

142152
/**
143153
* Get the separator
154+
*
155+
* @return {String}
144156
*/
145157
getSeparator: function () {
146158
return defaults.separator;
@@ -160,6 +172,8 @@
160172
function Locker (driver, namespace) {
161173

162174
/**
175+
* Out of the box drivers
176+
*
163177
* @type {Object}
164178
*/
165179
this._registeredDrivers = {
@@ -281,8 +295,8 @@
281295
/**
282296
* Trigger an event
283297
*
284-
* @param {String} name
285-
* @param {Object} payload
298+
* @param {String} name
299+
* @param {Object} payload
286300
* @return {void}
287301
*/
288302
this._event = function (name, payload) {
@@ -473,7 +487,7 @@
473487
},
474488

475489
/**
476-
* Return all items in storage within the current namespace
490+
* Return all items in storage within the current namespace/driver
477491
*
478492
* @return {Object}
479493
*/
@@ -492,7 +506,7 @@
492506
},
493507

494508
/**
495-
* Remove all items set within the current namespace
509+
* Remove all items set within the current namespace/driver
496510
*
497511
* @return {self}
498512
*/
@@ -554,10 +568,13 @@
554568
unbind: function ($scope, key) {
555569
$parse(key).assign($scope, void 0);
556570
this.forget(key);
557-
if (this._watchers[key + $scope.$id]) {
571+
572+
var watchId = key + $scope.$id;
573+
574+
if (this._watchers[watchId]) {
558575
// execute the de-registration function
559-
this._watchers[key + $scope.$id]();
560-
delete this._watchers[key + $scope.$id];
576+
this._watchers[watchId]();
577+
delete this._watchers[watchId];
561578
}
562579

563580
return this;

0 commit comments

Comments
 (0)