简体   繁体   English

主干木偶console.log将不会输出

[英]Backbone Marionette console.log won't output

I am brand new to marionette and am following along with a textbook to build a simple app using marionette. 我是木偶游戏的新手,并跟随一本教科书使用木偶构建一个简单的应用程序。 I ran into this problem almost immediately, they telly you to put a console.log() in a function, except it doesn't show up in my browser when i run it. 我几乎立即遇到了这个问题,他们告诉您将console.log()放入函数中,除了运行时它不会显示在我的浏览器中。 Here's the script below: 这是下面的脚本:

<script type="text/javascript">
var ContactManager = new Marionette.Application();
ContactManager.on("initialize:after", function(){
console.log("ContactManager has started!");
});
ContactManager.start();
</script>

And here's the whole HTML file: 这是整个HTML文件:

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Marionette Contact Manager</title>
<link href="./assets/css/bootstrap.css" rel="stylesheet">
<link href="./assets/css/application.css" rel="stylesheet">
</head>

<body>
<div class="navbar navbar-inverse navbar-fixed-top">
<div class="navbar-inner">
<div class="container">
<span class="brand">Contact manager</span>
</div>
</div>
</div>
<div class="container">
<p>Here is static content in the web page. You'll notice that it gets 21          replaced by our app as soon as we start it.</p>
</div>
<script src="./assets/js/vendor/jquery.js"></script>
<script src="./assets/js/vendor/json2.js"></script>
<script src="./assets/js/vendor/underscore.js"></script>
<script src="./assets/js/vendor/backbone.js"></script>
<script src="./assets/js/vendor/backbone.marionette.js"></script>

<script type="text/javascript">
var ContactManager = new Marionette.Application();
ContactManager.on("initialize:after", function(){
console.log("ContactManager has started!");
});
ContactManager.start();
</script>

</body>
</html>

Any help would be greatly appreciated, I can do a console.log() outside of the ContactManager.on() code and it will work. 任何帮助将不胜感激,我可以在ContactManager.on()代码之外执行console.log(),它将起作用。 Any ideas? 有任何想法吗?

So i figured out the answer to my own question with a little research. 因此,我通过一些研究找出了自己的问题的答案。 Marionette has updated "initialize:after" to "start". 木偶已将“初始化:之后”更新为“开始”。 For a full list of updates you can check here --> 有关更新的完整列表,您可以在这里查看->

https://github.com/marionettejs/backbone.marionette/blob/master/changelog.md#v100-rc1-view-commit-logs https://github.com/marionettejs/backbone.marionette/blob/master/changelog.md#v100-rc1-view-commit-logs

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM