Skip to content

Commit 37fe647

Browse files
committed
Upgrade to Vue 2
1 parent 867362d commit 37fe647

File tree

18 files changed

+5230
-306
lines changed

18 files changed

+5230
-306
lines changed

.eslintrc

Lines changed: 9 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -1,57 +1,11 @@
11
{
2-
"globals": {
3-
},
4-
"rules": {
5-
"indent": [
6-
2,
7-
2
8-
],
9-
"quotes": [
10-
1,
11-
"single"
12-
],
13-
"linebreak-style": 0,
14-
"no-console": 0,
15-
"no-unused-vars": 1
16-
},
17-
"settings": {
18-
"import/ignore": [
19-
]
20-
},
21-
"env": {
22-
"es6": true,
23-
"node": true,
24-
"browser": true
25-
},
26-
"ecmaFeatures": {
27-
"arrowFunctions": true,
28-
"destructuring": true,
29-
"classes": true,
30-
"defaultParams": true,
31-
"blockBindings": true,
32-
"modules": true,
33-
"objectLiteralComputedProperties": true,
34-
"objectLiteralShorthandMethods": true,
35-
"objectLiteralShorthandProperties": true,
36-
"restParams": true,
37-
"spread": true,
38-
"forOf": true,
39-
"generators": true,
40-
"templateStrings": true,
41-
"superInFunctions": true,
42-
"experimentalObjectRestSpread": true
43-
},
44-
"parserOptions": {
45-
"sourceType": "module",
46-
"ecmaFeatures": {
47-
"modules": true,
48-
"sourceType": "module",
49-
"spread": true,
50-
"experimentalObjectRestSpread": true
51-
}
52-
},
53-
"extends": "eslint:recommended",
54-
"plugins": [
55-
"html"
56-
]
2+
"extends": "vue",
3+
"parserOptions": {
4+
"ecmaVersion": 8
5+
},
6+
"env": {
7+
"es6": true,
8+
"node": true,
9+
"browser": true
10+
}
5711
}

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# Changelog
2+
3+
## 0.2.0 - 2017-01-15
4+
5+
- Upgraded to Vue 2.
6+
- Replaced [vue-resource](https://github.com/pagekit/vue-resource) with [axios](https://github.com/mzabriskie/axios).

README.md

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,16 @@
1616
- Set `GCM_KEY` and `GCM_SENDER_ID` from [Google Console](https://console.cloud.google.com)
1717
- (optional) Set `PUSHER_APP_ID`, `PUSHER_KEY`, `PUSHER_SECRET` from [Pusher](https://pusher.com/)
1818
- `php artisan migrate`
19-
- (optional) `npm install && gulp`
19+
- (optional) `npm install && gulp` / `yarn && gulp`
2020

21-
## Browser compatibility
21+
## Browser Compatibility
2222

23-
The Push API currently works on Chrome and Firefox. Some features like the notification close event only works on Chrome.
23+
The [Push API](https://developer.mozilla.org/en/docs/Web/API/Push_API) currently works on Chrome and Firefox. Some features like the notification close event only works on Chrome.
24+
25+
## Known Issues
26+
27+
- If you use [Laravel Valet](https://github.com/laravel/valet) for your local development the service worker might not start because of the self signed certificate. At least that happened to me on Windows, so I had to use Apache.
28+
29+
## Changelog
30+
31+
Please see [CHANGELOG](CHANGELOG.md) for more information what has changed recently.

composer.json

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
"php": ">=5.6.4",
99
"laravel/framework": "5.3.*",
1010
"laravel-notification-channels/webpush": "dev-master",
11-
"pusher/pusher-php-server": "^2.4"
11+
"pusher/pusher-php-server": "^2.6"
1212
},
1313
"require-dev": {
1414
"fzaninotto/faker": "~1.4",
@@ -47,8 +47,7 @@
4747
]
4848
},
4949
"config": {
50-
"preferred-install": "dist"
51-
},
52-
"minimum-stability": "dev",
53-
"prefer-stable": true
50+
"preferred-install": "dist",
51+
"sort-packages": true
52+
}
5453
}

gulpfile.js

Lines changed: 6 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,8 @@
1-
var elixir = require('laravel-elixir');
1+
const elixir = require('laravel-elixir')
22

3-
require('laravel-elixir-vue');
3+
require('laravel-elixir-vue-2')
44

5-
/*
6-
|--------------------------------------------------------------------------
7-
| Elixir Asset Management
8-
|--------------------------------------------------------------------------
9-
|
10-
| Elixir provides a clean, fluent API for defining some basic Gulp tasks
11-
| for your Laravel application. By default, we are compiling the Sass
12-
| file for our application, as well as publishing vendor resources.
13-
|
14-
*/
15-
16-
elixir(function(mix) {
17-
mix.sass('app.scss')
18-
.webpack('app.js');
19-
});
5+
elixir(mix => {
6+
mix.sass('app.scss')
7+
.webpack('app.js')
8+
})

package.json

Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,21 +2,26 @@
22
"private": true,
33
"scripts": {
44
"prod": "gulp --production",
5-
"dev": "gulp watch"
5+
"dev": "gulp watch --minimal"
66
},
7-
"devDependencies": {
7+
"dependencies": {
8+
"axios": "^0.15.3",
89
"bootstrap-sass": "^3.3.7",
9-
"gulp": "^3.9.1",
1010
"jquery": "^3.1.0",
11-
"laravel-elixir": "^6.0.0-9",
12-
"laravel-elixir-vue": "^0.1.4",
13-
"laravel-elixir-webpack-official": "^1.0.2",
14-
"lodash": "^4.14.0",
15-
"vue": "^1.0.26",
16-
"vue-resource": "^0.9.3",
11+
"laravel-echo": "^1.2.0",
12+
"pusher-js": "^4.0.0",
13+
"vue": "^2.1.8",
14+
"vue-timeago": "^3.1.5"
15+
},
16+
"devDependencies": {
17+
"eslint": "^3.13.0",
18+
"eslint-config-vue": "^2.0.1",
19+
"eslint-plugin-html": "^1.7.0",
20+
"eslint-plugin-vue": "^1.0.0",
21+
"gulp": "^3.9.1",
1722
"json-loader": "^0.5.4",
18-
"vue-timeago": "^2.1.2",
19-
"laravel-echo": "^0.1.0",
20-
"pusher-js": "^3.2.1"
23+
"laravel-elixir": "^6.0.0-15",
24+
"laravel-elixir-vue-2": "^0.3.0",
25+
"laravel-elixir-webpack-official": "^1.0.10"
2126
}
2227
}

public/css/app.css

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

public/css/app.css.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.

public/js/app.js

Lines changed: 10 additions & 12 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

public/sw.js

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
'use strict'
33

44
const WebPush = {
5-
init() {
5+
init () {
66
self.addEventListener('push', this.notificationPush.bind(this))
77
self.addEventListener('notificationclick', this.notificationClick.bind(this))
88
self.addEventListener('notificationclose', this.notificationClose.bind(this))
@@ -15,7 +15,7 @@
1515
*
1616
* @param {NotificationEvent} event
1717
*/
18-
notificationPush(event) {
18+
notificationPush (event) {
1919
if (!(self.Notification && self.Notification.permission === 'granted')) {
2020
return
2121
}
@@ -25,11 +25,10 @@
2525
event.waitUntil(
2626
this.sendNotification(event.data.json())
2727
)
28-
}
28+
} else {
2929
// Otherwise just fetch the last notification from the server.
30-
else {
3130
event.waitUntil(
32-
self.registration.pushManager.getSubscription().then((subscription) => {
31+
self.registration.pushManager.getSubscription().then(subscription => {
3332
if (subscription) {
3433
return this.fetchNofication(subscription)
3534
}
@@ -45,10 +44,10 @@
4544
*
4645
* @param {NotificationEvent} event
4746
*/
48-
notificationClick(event) {
47+
notificationClick (event) {
4948
// const data = event.notification.data
5049

51-
if (event.action == 'open') {
50+
if (event.action === 'open') {
5251
self.clients.openWindow('/')
5352
} else if (event.action === 'other') {
5453
//
@@ -64,8 +63,8 @@
6463
*
6564
* @param {NotificationEvent} event
6665
*/
67-
notificationClose(event) {
68-
self.registration.pushManager.getSubscription().then((subscription) => {
66+
notificationClose (event) {
67+
self.registration.pushManager.getSubscription().then(subscription => {
6968
if (subscription) {
7069
this.dismissNotification(event, subscription)
7170
}
@@ -77,7 +76,7 @@
7776
*
7877
* @param {PushMessageData|Object} data
7978
*/
80-
sendNotification(data) {
79+
sendNotification (data) {
8180
return self.registration.showNotification(data.title, {
8281
body: data.body,
8382
icon: data.icon || '/notification-icon.png',
@@ -92,13 +91,13 @@
9291
* @param {String} subscription.endpoint
9392
* @return {Response}
9493
*/
95-
fetchNofication({endpoint}) {
96-
return fetch(`/notifications/last?endpoint=${encodeURIComponent(endpoint)}`).then((response) => {
94+
fetchNofication ({ endpoint }) {
95+
return fetch(`/notifications/last?endpoint=${encodeURIComponent(endpoint)}`).then(response => {
9796
if (response.status !== 200) {
9897
throw new Error()
9998
}
10099

101-
return response.json().then((data) => {
100+
return response.json().then(data => {
102101
return this.sendNotification(data)
103102
})
104103
})
@@ -111,12 +110,12 @@
111110
* @param {String} subscription.endpoint
112111
* @return {Response}
113112
*/
114-
dismissNotification({notification}, {endpoint}) {
113+
dismissNotification ({ notification }, { endpoint }) {
115114
if (!notification.data.id) {
116115
return
117116
}
118117

119-
const data = new FormData
118+
const data = new FormData()
120119
data.append('endpoint', endpoint)
121120

122121
// Send a request to the server to mark the notification as read.
@@ -128,4 +127,4 @@
128127
}
129128

130129
WebPush.init()
131-
})();
130+
})()

0 commit comments

Comments
 (0)