This file contains hidden or 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
/** | |
* Copyright 2015-2016, Google, Inc. | |
* Licensed under the Apache License, Version 2.0 (the "License"); | |
* you may not use this file except in compliance with the License. | |
* You may obtain a copy of the License at | |
* | |
* http://www.apache.org/licenses/LICENSE-2.0 | |
* | |
* Unless required by applicable law or agreed to in writing, software | |
* distributed under the License is distributed on an "AS IS" BASIS, |
This file contains hidden or 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
<!doctype html> | |
<html ⚡> | |
<head> | |
<meta charset="utf-8"> | |
<script async src="https://cdn.ampproject.org/v0.js"></script> | |
<script async custom-element="amp-form" src="https://cdn.ampproject.org/v0/amp-form-0.1.js"></script> | |
<script async custom-template="amp-mustache" src="https://cdn.ampproject.org/v0/amp-mustache-0.1.js"></script> | |
<link rel="canonical" href="./amp-form-sub.html"> | |
<meta name="viewport" content="width=device-width,minimum-scale=1,initial-scale=1"> | |
<style amp-boilerplate>body{-webkit-animation:-amp-start 8s steps(1,end) 0s 1 normal both;-moz-animation:-amp-start 8s steps(1,end) 0s 1 normal both;-ms-animation:-amp-start 8s steps(1,end) 0s 1 normal both;animation:-amp-start 8s steps(1,end) 0s 1 normal both}@-webkit-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}@-moz-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}@-ms-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}@-o-keyframes -amp-start{from{visibility:hidden}to{visibility |
This file contains hidden or 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
<!-- Defines element markup --> | |
<template id="gigya-comments-template"> | |
<style> | |
.comment { | |
margin-bottom: 20px; | |
} | |
.author { | |
display: block; | |
font-style: italic; |
This file contains hidden or 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
const options = { | |
filters: [{services: ['ce060000-43e5-11e4-916c-0800200c9a66']}], | |
optionalServices: [ | |
'ce060010-43e5-11e4-916c-0800200c9a66', // Information Service. | |
'ce060020-43e5-11e4-916c-0800200c9a66', // Control Service. | |
'ce060030-43e5-11e4-916c-0800200c9a66' // Rowing Service. | |
] | |
}; | |
navigator.bluetooth.requestDevice(options) | |
.then(device => { |
This file contains hidden or 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
const options = { | |
filters: [{services: ['ce060000-43e5-11e4-916c-0800200c9a66']}], | |
optionalServices: [ | |
'ce060010-43e5-11e4-916c-0800200c9a66', // Information Service. | |
'ce060020-43e5-11e4-916c-0800200c9a66', // Control Service. | |
'ce060030-43e5-11e4-916c-0800200c9a66' // Rowing Service. | |
] | |
}; | |
navigator.bluetooth.requestDevice(options) | |
.then(device => { |
This file contains hidden or 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
device.gatt.connect() | |
.then(server => { | |
server.getPrimaryService('ce060030-43e5-11e4-916c-0800200c9a66') // Rowing Service. | |
.then(rowingService => { | |
// ... | |
}); | |
}); |
This file contains hidden or 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
rowingService.getCharacteristic('ce060031-43e5-11e4-916c-0800200c9a66') // General Info. | |
.then(generalInfoCharacteristic => generalInfoCharacteristic.startNotifications()) | |
.then(generalInfoCharacteristic => { | |
generalInfoCharacteristic.addEventListener('characteristicvaluechanged', e => { | |
// Parse characteristic value. | |
}); | |
}); |
This file contains hidden or 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
serialNumberCharacteristic.addEventListener('characteristicvaluechanged', e => { | |
const decoder = new TextDecoder('utf-8'); | |
const value = decoder.decode(e.target.value); | |
// ... | |
}); |
This file contains hidden or 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
generalStatusCharacteristic.addEventListener('characteristicvaluechanged', e => { | |
const dataView = e.target.value; | |
const avgStrokeRate = dataView.getUint8(10); | |
const endingHeartRate = dataView.getUint8(11); | |
const averageHeartRat = dataView.getUint8(12); | |
// ... | |
}); |
This file contains hidden or 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
gulp.task('generate-service-worker', callback => { | |
const rootDir = 'dist'; | |
swPrecache.write(path.join(rootDir, 'service-worker.js'), { | |
staticFileGlobs: [rootDir + '/**/*.{js,html,css,png,jpg,gif,svg,eot,ttf,woff}'], | |
stripPrefix: rootDir | |
}, callback); | |
}); |