forked from ampproject/amphtml
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patharticle-access-iframe.provider.html
41 lines (39 loc) · 1.05 KB
/
article-access-iframe.provider.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
<!doctype html>
<html>
<head>
<!-- Currently a sync script. -->
<script src="/extensions/amp-access/0.1/iframe-api/build/index.js"></script>
<script>
function log() {
if (!console || !console.log) {
return;
}
var var_args = Array.prototype.slice.call(arguments, 0);
var_args.unshift('[amp-access-iframe]');
console.log.apply(console, var_args);
}
/** Implementation of AccessController */
var Controller = function() {
};
Controller.prototype.connect = function(origin, protocol, config) {
log('connect: ', origin, protocol, config);
};
Controller.prototype.authorize = function() {
log('authorize');
// This is the JSON expected in the article-access-iframe.amp.html.
return Promise.resolve({
views: 3,
maxViews: 5
});
};
Controller.prototype.pingback = function() {
log('pingback');
};
var iframeApi = new AmpAccessIframeApi(new Controller());
iframeApi.connect();
</script>
</head>
<body>
Hidden iframe.
</body>
</html>