mirror of
https://github.com/moparisthebest/kaiwa
synced 2024-11-18 07:15:08 -05:00
32 lines
871 B
JavaScript
32 lines
871 B
JavaScript
/*global app, me*/
|
|
"use strict";
|
|
|
|
var BasePage = require('./base');
|
|
var templates = require('../templates');
|
|
|
|
|
|
module.exports = BasePage.extend({
|
|
template: templates.pages.main,
|
|
classBindings: {
|
|
'shouldAskForAlertsPermission': '.enableAlerts'
|
|
},
|
|
events: {
|
|
'click .enableAlerts': 'enableAlerts'
|
|
},
|
|
initialize: function (spec) {
|
|
me.shouldAskForAlertsPermission = app.notifier.shouldAskPermission();
|
|
this.renderAndBind();
|
|
},
|
|
enableAlerts: function () {
|
|
app.notifier.askPermission(function () {
|
|
var shouldAsk = app.notifier.shouldAskPermission();
|
|
if (!shouldAsk) {
|
|
app.notifier.show({
|
|
title: 'Ok, sweet!',
|
|
description: "You'll now be notified of stuff that happens."
|
|
});
|
|
}
|
|
});
|
|
}
|
|
});
|