Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(218)

Side by Side Diff: chrome/common/extensions/docs/examples/howto/sandbox/sandbox.html

Issue 10810054: Describing the `sandbox` workflow for extension developers. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: TODO + Rebuild. Created 8 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 <!--
2 - Copyright (c) 2012 The Chromium Authors. All rights reserved.
3 - Use of this source code is governed by a BSD-style license that can be
4 - found in the LICENSE file.
5 -->
6 <!doctype html>
7 <html>
8 <head>
9 <script src="handlebars-1.0.0.beta.6.js"></script>
10 </head>
11 <body>
12 <script id="hello-world-template" type="text/x-handlebars-template">
13 <div class="entry">
14 <h1>Hello, {{thing}}!</h1>
15 </div>
16 </script>
17 <script>
18 var templates = [];
19 var source = document.getElementById('hello-world-template').innerHTML;
20 templates['hello'] = Handlebars.compile(source);
21
22 // Set up message event handler:
23 window.addEventListener('message', function(event) {
24 var command = event.data.command;
25 var name = event.data.name || 'hello';
26 switch(command) {
27 case 'render':
28 event.source.postMessage({
29 name: name,
30 html: templates[name](event.data.context)
31 }, event.origin);
32 break;
33
34 // You could imagine additional functionality. For instance:
35 //
36 // case 'new':
37 // templates[event.data.name] = Handlebars.compile(event.data.source );
38 // event.source.postMessage({name: name, success: true}, event.origi n);
39 // break;
40 }
41 });
42 </script>
43 </body>
44 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698