How to load scripts first when needed with require.js?

Background I have a long list of models and views made with backbone.js - but not all users will open all views. I use require.js to load JavaScripts files and templates. What I have now I have a router that knows about all views. Since the router know this, all views, models and templates are therefore loaded at startup - this also loads randomly visited views. Problem How can I use

如何在需要时使用require.js首先加载脚本?

背景 我有很多使用backbone.js制作的模型和视图 - 但并非所有用户都会打开所有视图。 我使用require.js来加载JavaScript文件和模板。 我现在拥有的 我有一台了解所有视图的路由器。 由于路由器知道这一点,因此所有视图,模型和模板都会在启动时加载 - 这也加载了随机访问的视图。 问题 如何在需要时使用require.js加载JavaScript? 不是在初始启动时,而是在用户第一次打开视图时。 更新我现在可以通过下面的答

Chrome extension in Angular 2/4

I am trying to create a chrome extension for google chrome browser using Angular 4. I just need the url and title of the page, where I am clicking on the browser icon(click event). So far I have done following things I have created a eventPage and that page is getting called when I click the icon of extension. Code=> if (typeof chrome.browserAction !== 'undefined') { chrome.browserAct

在Angular 2/4中的Chrome扩展

我正在尝试为使用Angular 4的谷歌Chrome浏览器创建Chrome扩展。我只需要页面的URL和标题,在浏览器图标(单击事件)上点击。 到目前为止,我做了以下事情 我创建了一个eventPage,当点击扩展名图标时,该页面会被调用。 代码=> if (typeof chrome.browserAction !== 'undefined') { chrome.browserAction.onClicked.addListener(function(tab) { listService.getBookmarks().then(bookmarkLists => {

How can a Chrome extension save many files to a user

I'm working on a Chrome extension to be used as an internal tool. Its required behavior is: As a page action, enable an address bar icon when looking at certain intranet pages. when the user clicks the icon, identify all files of a certain media type (say, .jpg) on the page, and silently save them all to a directory on the user's local drive. This question has been asked before,

Chrome扩展程序如何将许多文件保存到用户

我正在研究Chrome扩展程序以用作内部工具。 其要求的行为是: 作为页面操作,在查看特定内联网页面时启用地址栏图标。 当用户点击图标时,识别页面上某种媒体类型(比如说.jpg)的所有文件 静静地将它们全部保存到用户本地驱动器上的目录中。 这个问题之前已经被问到过,但是答案是“使用NPAPI”,现在NPAPI已经失效了。 那么,目前可用的方法是什么呢? 我看过的是: chrome.FileSystem API--但不会将文件保存在任

android app with apache cordova

I'm developing a web app using HTML5,CSS3 and JavaScript. Then I want to use the Apache ordova platform to generate a native android app from my web app but I still don't understand what do I need for this,specially do I need a server-side development with php for example?? First off i suggest you read this Pretty much your app will be able to accomplish a little bit more than what you

Android的应用程序与Apache科多瓦

我正在开发一个使用HTML5,CSS3和JavaScript的Web应用程序。 然后,我想使用Apache ordova平台从我的web应用程序生成原生android应用程序,但我仍然不明白我需要什么,特别是我需要使用php进行服务器端开发吗? 首先我建议你阅读这篇文章如果你所有的应用程序都能够编写html / js *,那么你的应用程序将能够完成比浏览器能够做的更多的工作。 *通过这个我意味着你可以访问设备特定的硬件,这在浏览器中不可用,还有更多的东

dojo.store.Observable, JSON REST and queryEngine

Does anybody know how to use the JsonRest store in dojo witn an Observable weapper, like the one in dojo.store.Observable? What do I need, server side, to implement the store and make it work as an Observable one? What about the client side? The documentation says http://dojotoolkit.org/reference-guide/1.7/dojo/store/Observable.html If you are using a server side store like the JsonRest sto

dojo.store.Observable,JSON REST和queryEngine

有人知道如何在Dojo中使用JsonRest存储,并使用可观察的武器,如dojo.store.Observable中的那个? 我需要什么,服务器端来实现商店并使其作为可观察商店? 客户端呢? 该文档说明了http://dojotoolkit.org/reference-guide/1.7/dojo/store/Observable.html 如果您使用的是像JsonRest商店这样的服务器端商店,则需要提供queryEngine以便更新对象正确包含在查询中或从查询中排除。 如果queryEngine不可用,则观察侦听器将使

Javascript Marquee to replace <marquee> tags

I'm hopeless at Javascript. This is what I have: <script type="text/javascript"> function beginrefresh(){ //set the id of the target object var marquee = document.getElementById("marquee_text"); if(marquee.scrollLeft >= marquee.scrollWidth - parseInt(marquee.style.width)) { marquee.scrollLeft = 0; } marquee.scrollLeft += 1;

Javascript Marquee取代<marquee>标签

我对Javascript毫无希望。 这是我拥有的: <script type="text/javascript"> function beginrefresh(){ //set the id of the target object var marquee = document.getElementById("marquee_text"); if(marquee.scrollLeft >= marquee.scrollWidth - parseInt(marquee.style.width)) { marquee.scrollLeft = 0; } marquee.scrollLeft += 1; //

Compiling Erlang To Javascript Via Core Erlang

So started making progress on LuvvieScript and then it all kicked off a bit on Twitter... https://twitter.com/gordonguthrie/status/389659700741943296 Anthony Ramine https://twitter.com/nokusu made the point that I was doing it wrong and I should be compiling from Erlang to JavaScript via Core Erlang and not the Erlang AST. This is both an compelling yet unattractive option for me... Twitter no

通过Core Erlang编译Erlang到Javascript

所以开始在LuvvieScript上取得进展,然后它在Twitter上开始了一段时间... https://twitter.com/gordonguthrie/status/389659700741943296 Anthony Ramine https://twitter.com/nokusu指出我做错了,我应该从Erlang通过Core Erlang编译为JavaScript,而不是Erlang AST。 对于我来说,这既是一个引人注目但又不吸引人的选择...... Twitter并不是这次讨论的正确媒介,我想我会在这里写下它并获得一些建议。 战略概述 LuvvieS

CasperJS getElementsByXPath only returning first element

I use the following code to get all table cells in the first table row. I'd like to then check the innerHTML of every single table cell. But in the object returned by this function only the first table cell is actually there, all the other properties are null: firstRow = this.evaluate(function () { return __utils__.getElementsByXPath('//tbody/tr[1]/td'); }); utils.dump(firstRow); The

CasperJS getElementsByXPath只返回第一个元素

我使用下面的代码来获取第一个表格行中的所有表格单元格。 然后,我想检查每个表格单元格的innerHTML。 但是在这个函数返回的对象中,只有第一个表格单元格实际存在,所有其他属性都是null: firstRow = this.evaluate(function () { return __utils__.getElementsByXPath('//tbody/tr[1]/td'); }); utils.dump(firstRow); utils.dump的输出是: [ { "abbr": "", "align": "", "attributes

How would you go about applying force to an object?

To clarify - ammo.js is a port of Bullet Physics using mscripten I have a character (essentially a block) that needs to be pushed with force. I have tried (I think) all of the methods for forces but I still cannot move the block. setVelocity(1,0,0) does not even move the block - it just stops gravity from acting on it! applyImpulse([0,0,200000],[0,0,0]) does absolutely nothing. applyForce

你将如何去对物体施力?

澄清 - ammo.js是使用mscripten的子弹物理的端口 我有一个角色(本质上是一个块),需要用武力推动。 我试过(我认为)所有的力量方法,但我仍然无法移动该块。 setVelocity(1,0,0)甚至不会移动块 - 它只是停止重力作用于它! applyImpulse([0,0,200000],[0,0,0])完全没有。 applyForce([0,0,200000],[0,0,0])完全没有。 由于ammo.js是一个emscripten端口,所以你必须使用它的本地数据类型来跟它交谈...... 所以为了

How to create and edit unpublished facebook post with image?

I want to create unpublished image post on facebook and then edit the message attached to it. I can create an image by doing: /me/photos url: somewhere published: false caption: 'abc' This, due to documentation should return Struct { id: numeric string, post_id: string, } But it doesn't return post_id. If published is set to false the post_id is omitted. When I visit created photo

如何使用图像创建和编辑未发布的Facebook文章?

我想在Facebook上创建未发布的图像文章,然后编辑附加到它的消息。 我可以通过这样做来创建一个图像: /me/photos url: somewhere published: false caption: 'abc' 这由于文档应该返回 Struct { id: numeric string, post_id: string, } 但它不会返回post_id。 如果发布设置为false,则省略post_id。 当我访问Facebook上创建的照片时,我可以编辑照片的附加标题和其他参数。 但是,当我试图通过API来做到这一点时