-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ba0f762
commit 44d7da2
Showing
5 changed files
with
128 additions
and
77 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
# polymer-cookie Changelog | ||
|
||
## 1.1.0 - 2016.06.15 | ||
|
||
* introducing Domain | ||
* introducing HttpOnly | ||
* path and domain set as optional values | ||
* minor code refactoring and documentation update | ||
|
||
## 1.0.4 - 2016.06.02 | ||
|
||
* minor code refactoring | ||
* documentation updated | ||
* cookie expiration time bug fixed when time is set to '-1' | ||
* demo page introduced | ||
|
||
## 1.0.3 - 2016.02.12 | ||
|
||
* autoSet implementation | ||
* fixes createCookie | ||
* removes encodeURIComponent | ||
* fixes readCookie declaration | ||
* documentation updated | ||
|
||
## 0.1.2 - 2015.29.01 | ||
|
||
* Implemented reflectToAttribute capability | ||
|
||
## 0.1.1 - 2015.07.01 | ||
|
||
* first stable version | ||
|
||
## 0.1.0 - 2015.06.30 | ||
|
||
* initial commit |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,11 @@ | ||
# polymer-cookie | ||
|
||
<img src="http://benschwarz.github.io/bower-badges/[email protected]" width="130" height="30"> | ||
> Cookie Web Component for Polymer 1.x | ||
[![Bower version](https://badge.fury.io/bo/polymer-cookie.svg)](https://badge.fury.io/bo/polymer-cookie) | ||
|
||
![](http://benschwarz.github.io/bower-badges/[email protected]) | ||
|
||
Cookie Web Component for Polymer 1.0 | ||
|
||
```html | ||
|
@@ -29,49 +31,63 @@ Note: The `params` attribute must be double quoted JSON. | |
|
||
Add the library using the Javascript package manager [Bower](http://bower.io/): | ||
|
||
``` | ||
bower install --save polymer-cookie | ||
```shell | ||
$ bower install --save polymer-cookie | ||
``` | ||
|
||
Or clone this repository inside your project folder using Git: | ||
|
||
``` | ||
git clone https://github.com/andreasonny83/polymer-cookie.git | ||
```shell | ||
$ git clone https://github.com/andreasonny83/polymer-cookie.git | ||
``` | ||
|
||
## Properties | ||
|
||
### name | ||
|
||
Type: String | ||
|
||
Default value: 'polymer-cookie' | ||
|
||
Set the cookie name | ||
|
||
### value | ||
|
||
type: String | ||
|
||
Default value: '' | ||
|
||
The cookie value | ||
|
||
### path | ||
|
||
type: String | ||
Default value: '/' | ||
|
||
The cookie path | ||
Default value: '' | ||
|
||
The cookie path. | ||
|
||
The path must be absolute. | ||
If not specified, defaults to the current path of the current document location. | ||
|
||
### domain | ||
|
||
type: String | ||
|
||
Default value: '' | ||
|
||
The cookie domain | ||
The cookie domain. | ||
|
||
(e.g., 'example.com' or 'subdomain.example.com'). | ||
If not specified, defaults to the host portion of the current document location | ||
(but not including subdomains). Contrary to earlier specifications, | ||
leading dots in domain names are ignored. If a domain is specified, | ||
subdomains are always included. | ||
|
||
### time | ||
|
||
type: Number | ||
|
||
Default value: 1 | ||
|
||
The expiration time related to the 'format' value. | ||
|
@@ -80,6 +96,7 @@ Set to -1 to never expire the cookie | |
### format | ||
|
||
type: String | ||
|
||
Default value: 'd' | ||
|
||
The expiration format time | ||
|
@@ -89,9 +106,28 @@ The expiration format time | |
* 'h' : hours | ||
* 'd' : days | ||
|
||
### secure | ||
|
||
type: Boolean | ||
|
||
Default value: false | ||
|
||
Cookie to only be transmitted over secure protocol as https | ||
|
||
### http-only | ||
|
||
type: Boolean | ||
|
||
Default value: false | ||
|
||
The HTTPOnly cookie attribute can help to mitigate this attack by | ||
preventing access to cookie value through Javascript. Read more about | ||
[Cookies and Security](https://www.nczonline.net/blog/2009/05/12/cookies-and-security/). | ||
|
||
### auto-set | ||
|
||
type: Boolean | ||
|
||
Default value: false | ||
|
||
If set, creates the cookie as the element is rendered on the page without | ||
|
@@ -103,7 +139,7 @@ the need of manually invoking createCookie | |
|
||
Write the cookie | ||
|
||
``` | ||
```js | ||
var cookie = Polymer.dom(document).querySelector('#user_cookie'); | ||
cookie.createCookie(); | ||
``` | ||
|
@@ -112,7 +148,7 @@ cookie.createCookie(); | |
|
||
Read the cookie if any, and the returns its value | ||
|
||
``` | ||
```js | ||
var cookie = Polymer.dom(document).querySelector('#user_cookie'); | ||
var cookie_value = cookie.readCookie(); | ||
``` | ||
|
@@ -121,19 +157,19 @@ var cookie_value = cookie.readCookie(); | |
|
||
Destroy the cookie | ||
|
||
``` | ||
```js | ||
var cookie = Polymer.dom(document).querySelector('#user_cookie'); | ||
cookie.eraseCookie(); | ||
``` | ||
|
||
## Rendering in a demo page | ||
|
||
### Install Polymer CLI. | ||
### Install Polymer CLI | ||
|
||
Install the Polymer CLI to serve the demo locally with: | ||
|
||
``` | ||
npm install -g polymer-cli | ||
```shell | ||
$ npm install -g polymer-cli | ||
``` | ||
|
||
### Run the demo | ||
|
@@ -142,8 +178,8 @@ To run the element demo: | |
|
||
Run polymer serve from the repo directory: | ||
|
||
``` | ||
polymer serve | ||
```shell | ||
$ polymer serve | ||
``` | ||
|
||
Then open localhost:8080/components/polymer-cookie/demo/ in your browser. | ||
|
@@ -156,52 +192,26 @@ For more information about Polymer CLI have a look at the | |
A special thanks to [Cameron](https://github.com/cameronwp) | ||
and [Pascal](https://github.com/MeTaNoV) for their contributions. | ||
|
||
1. Fork it! | ||
1. Fork it! | ||
2. Create your feature branch: `git checkout -b my-new-feature` | ||
3. Commit your changes: `git commit -m 'Add some feature'` | ||
3. Commit your changes: `git commit -m 'Add some feature'` | ||
4. Push to the branch: `git push origin my-new-feature` | ||
5. Submit a pull request :D | ||
5. Submit a pull request :D | ||
|
||
## Contributors | ||
|
||
## License | ||
A special thanks to our contributors: | ||
|
||
[MIT License](https://github.com/andreasonny83/polymer-cookie/blob/master/LICENSE) © Andrea SonnY | ||
* [@cameronwp](https://github.com/cameronwp) | ||
* [@MeTaNoV](https://github.com/MeTaNoV) | ||
* [@ymahnovskyy](https://github.com/ymahnovskyy) | ||
* [@web-padawan](https://github.com/web-padawan) | ||
|
||
## Changelog | ||
|
||
### 1.0.4 | ||
|
||
* minor code refactoring | ||
* documentation updated | ||
* cookie expiration time bug fixed when time is set to '-1' | ||
* demo page introduced | ||
|
||
2016.06.02 | ||
Changelog available [here](https://github.com/andreasonny83/polymer-cookie/blob/master/CHANGELOG.md) | ||
|
||
### 1.0.3 | ||
|
||
* autoSet implementation | ||
* fixes createCookie | ||
* removes encodeURIComponent | ||
* fixes readCookie declaration | ||
* documentation updated | ||
|
||
2016.02.12 | ||
|
||
### 0.1.2 | ||
|
||
* Implemented reflectToAttribute capability | ||
|
||
2015.29.01 | ||
|
||
### 0.1.1 | ||
|
||
* first stable version | ||
|
||
2015.07.01 | ||
|
||
### 0.1.0 | ||
|
||
* initial commit | ||
## License | ||
|
||
2015.06.30 | ||
[MIT License](https://github.com/andreasonny83/polymer-cookie/blob/master/LICENSE) | ||
© Andrea SonnY |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,15 @@ | ||
{ | ||
"name": "polymer-cookie", | ||
"version": "1.0.4", | ||
"homepage": "https://github.com/andreasonny83/polymer-cookie", | ||
"authors": [ | ||
"Andrea Sonny <[email protected]>" | ||
], | ||
"description": "Cookie Web Component for Polymer 1.0", | ||
"description": "Cookie Web Component for Polymer 1.x", | ||
"main": "polymer-cookie.html", | ||
"keywords": [ | ||
"web-components", | ||
"polymer" | ||
"polymer", | ||
"cookie" | ||
], | ||
"license": "MIT", | ||
"ignore": [ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters