1
0
mirror of https://github.com/moparisthebest/kaiwa synced 2025-02-21 05:21:47 -05:00

32 lines
871 B
JavaScript
Raw Normal View History

2013-09-12 11:18:44 -07:00
/*global app, me*/
2013-08-29 20:38:28 -07:00
"use strict";
var BasePage = require('./base');
var templates = require('../templates');
module.exports = BasePage.extend({
template: templates.pages.main,
2013-09-12 11:18:44 -07:00
classBindings: {
'shouldAskForAlertsPermission': '.enableAlerts'
},
events: {
'click .enableAlerts': 'enableAlerts'
},
2013-08-29 20:38:28 -07:00
initialize: function (spec) {
2013-09-12 11:18:44 -07:00
me.shouldAskForAlertsPermission = app.notifier.shouldAskPermission();
2013-08-29 20:38:28 -07:00
this.renderAndBind();
2013-09-12 11:18:44 -07:00
},
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."
});
}
});
2013-08-29 20:38:28 -07:00
}
});