Commits

Matthew Schinckel  committed fbf5808

Rename

  • Participants
  • Parent commits accc42c

Comments (0)

Files changed (2)

File src/cookie.js

-(function (root, factory) {
-    if (typeof define === 'function' && define.amd) {
-        // AMD. Register as an anonymous module.
-        define(['jquery', 'knockout', 'jquery.cookie'], function ($, ko) {
-            return factory($, ko);
-        });
-    } else {
-        // Browser globals
-        factory(root.$, root.ko);
-    }
-}(this, function ($, ko) {
-  
-  ko.extenders.cookie = function(target, options) {
-    var cookie_name, persist;
-    if (typeof options === 'string') {
-      cookie_name = options;
-      persist = true;
-    } else {
-      cookie_name = options.name;
-      persist = options.persist;
-    }
-    
-    target($.cookie(cookie_name));
-    
-    return ko.computed({
-      read: target,
-      write: function(value) {
-        // If our persist value returns true, then store in a cookie,
-        // else remove a cookie with that name if one exists.
-        if (ko.utils.unwrapObservable(persist)) {
-          $.cookie(cookie_name, value);
-        } else {
-          $.removeCookie(cookie_name);
-        }
-        
-        // If null or undefined was passed to the observable, then
-        // unset the associated cookie.
-        if (value === null || value === undefined) {
-          $.removeCookie(cookie_name);
-        }
-        
-        target(value);
-      }
-    });
-  }
-}));

File src/knockout.cookie.js

+(function (root, factory) {
+    if (typeof define === 'function' && define.amd) {
+        // AMD. Register as an anonymous module.
+        define(['jquery', 'knockout', 'jquery.cookie'], function ($, ko) {
+            return factory($, ko);
+        });
+    } else {
+        // Browser globals
+        factory(root.$, root.ko);
+    }
+}(this, function ($, ko) {
+  
+  ko.extenders.cookie = function(target, options) {
+    var cookie_name, persist;
+    if (typeof options === 'string') {
+      cookie_name = options;
+      persist = true;
+    } else {
+      cookie_name = options.name;
+      persist = options.persist;
+    }
+    
+    target($.cookie(cookie_name));
+    
+    return ko.computed({
+      read: target,
+      write: function(value) {
+        // If our persist value returns true, then store in a cookie,
+        // else remove a cookie with that name if one exists.
+        if (ko.utils.unwrapObservable(persist)) {
+          $.cookie(cookie_name, value);
+        } else {
+          $.removeCookie(cookie_name);
+        }
+        
+        // If null or undefined was passed to the observable, then
+        // unset the associated cookie.
+        if (value === null || value === undefined) {
+          $.removeCookie(cookie_name);
+        }
+        
+        target(value);
+      }
+    });
+  }
+}));