mirror of
https://github.com/protobufjs/protobuf.js.git
synced 2025-12-08 20:58:55 +00:00
24 lines
543 B
HTML
24 lines
543 B
HTML
<!DOCTYPE html>
|
|
<html>
|
|
<head><script src="../dist/protobuf.min.js"></script></head>
|
|
<body>
|
|
<script>
|
|
protobuf.util.fetch("browser.html")
|
|
.then(function(source) {
|
|
var pre = document.createElement("pre");
|
|
pre.innerText = source;
|
|
document.body.appendChild(pre);
|
|
console.log("success");
|
|
})
|
|
.catch(function(err) {
|
|
console.log("error", err);
|
|
});
|
|
|
|
var root = new protobuf.Root();
|
|
console.log(root.toString());
|
|
var message = new protobuf.Type("Message");
|
|
root.add(message);
|
|
console.log(message.toString());
|
|
</script>
|
|
</body>
|
|
</html> |