Tag: google chrome

在AoT构build之后无法删除文件

当我从我的package.json文件运行build:prod命令时,编译生成成功,但无法删除.ngsummary.json文件以及所有.ngfactory.ts文件 package.json文件: { "name": "name", "version": "1.0.0", "private": true, "scripts": { "start": "node ./bin/www", "build": "del-cli public/js/app && webpack –config webpack.config.dev.js –progress –profile –watch", "build:prod": "del-cli public/js/app && ngc -p tsconfig.aot.json && ngc -p tsconfig.aot.json && webpack –config webpack.config.prod.js –progress –profile –bail && del-cli 'public/js/app/**/*.js' 'public/js/app/**/*.js.map' '!public/js/app/bundle.js' '!public/js/app/*.chunk.js' 'assets/app/**/*.*.ngfactory.ts' 'assets/app/**/*.shim.ts' 'assets/app/**/*.ngsummary.json' 'assets/app/**/*.ngstyle.ts'" }, "dependencies": { […]

在浏览器中查看PDF – 使用POST在Chrome中破解

所以我不知道什么时候,但显然Chrome已经发生了一些变化,在浏览器中浏览了PDF。 查看这些内部的Firefox或IE工作; 这似乎是一个纯Chrome的问题。 截至目前,我是如何做到这一点的。 用户将数据发布到服务器,这对PDF使用者来说有一些神奇的作用,并将PDF发送回浏览器。 我们正确地使用Content-Disposition , Content-Length和Content-Type标题(我假设): Content-Disposition: "inline; filename=\"some-pdf.pdf\"" Content-Length: "1860799" Content-Type: "application/pdf" Chrome浏览器拒绝使用浏览器中的PDF查看器加载这些文件有什么具体原因吗? 编辑: 看起来Chrome在POST服务器时不加载内嵌文件。 工作示例: var express = require('express'); var fs = require('fs'); var app = express(); app.listen(3000, function() { console.log('Listening on http://localhost:3000'); }); app.get('/', function(req, res, next) { fs.stat('./some-pdf.pdf', function(e, stats) { if(e) throw e; var stream = fs.createReadStream( './some-pdf.pdf' […]

运行V8 JavaScript引擎的示例代码时出错

尝试在链接1上运行代码时出现以下错误。请帮助如何解决此问题 链接1: https : //developers.google.com/v8/get_started#audience ————————————错误开始———— ————————– amit-macbook:v8 amit.sood$ g++ -Iinclude hello_world.cpp -o hello_world -Wl,–start-group out/x64.release/obj.target/{tools/gyp/libv8_{base,libbase.x64,snapshot},third_party/icu/libicu{uc,i18n,data}}.a -Wl,–end-group -lrt clang: error: no such file or directory: 'out/x64.release/obj.target/tools/gyp/libv8_base.a' clang: error: no such file or directory: 'out/x64.release/obj.target/tools/gyp/libv8_libbase.x64.a' clang: error: no such file or directory: 'out/x64.release/obj.target/tools/gyp/libv8_snapshot.a' clang: error: no such file or directory: 'out/x64.release/obj.target/third_party/icu/libicuuc.a' clang: error: no such file […]

对JavaScript文件的更改不会立即生效。 gulp browserify任务可能存在问题

当对JavaScript文件进行更改时,在更改生效之前,经常需要长达10秒的不断刷新页面。 我知道Chromecaching了很多,我已经使用了一些技术来解决这个问题: 我已经设置caching控制头'no-cache,no-store',添加一个基于当前时间的查询string到每一个JavaScript文件(我已经证实,这实际上每次刷新时都会改变),我有启用开发工具中的“禁用caching”选项。 但是,JavaScript文件仍然不能立即加载… 编辑:经过一些更多的testing后,我发现我的node.js应用程序中的gulp browserify任务(构build客户端JavaScript包)在gulp重新启动后5-10秒之前不会更新构build。 然而,这是奇怪的,因为吞吐量输出“3.24毫秒后完成”browserify“。 这就解释了为什么JavaScript文件不能在浏览器中刷新,但我无法弄清楚为什么不能立即刷新。 有没有人经历过这个?

如何将iBeacon闪存/升级到Eddystone?

我有一堆来自中国的通用信标,我想升级到Eddystone。 我怎么去做这个?

为nodeJS(或浏览器)创build一个asychroneous api

大多数NodeJS程序员知道为什么阻塞NodeJS的单线程事件循环是不好的。 例如,在读取文件时,我们知道最好使用fs.readFile而不是fs.readFileSync。 我的问题是:如果由API执行的基本任务本质上是同步的,那么如何创build一个asyn API呢? 换句话说,我该如何去创build一个像fs.readFileSync这样的API,而不是使用事件循环线程来执行底层任务呢? 我必须走出NodeJS和Javascript来做到这一点吗?

运行navalia示例的打字稿错误

我试图从https://github.com/joelgriffith/navalia运行这个例子,但为了我的光,我不能没有错误地工作: navaliatest.ts /// <reference path="typings.d.ts" /> import { Chrome } from 'navalia'; const chrome = new Chrome(); async function buyItOnAmazon() { const url = await chrome.goto('https://amazon.com'); const typed = await chrome.type('input', 'Kindle'); const clicked = await chrome.click('.nav-search-submit input'); chrome.done(); console.log(url, typed, clicked); // 'https://www.amazon.com/', true, true } buyItOnAmazon(); tsconfig.json { "files": [ "navaliatest.ts" ], "compilerOptions": […]

节点与Chrome,实施instanceof,多个文件

我有这个奇怪的行为,希望你能帮助我。 =) 我有一个设置,我需要使用Mocha运行JavaScripttesting。 代码由TypeScript生成,testing通过commonjs和commonjs模块在浏览器和nodejs中运行。 问题是,我想使用instanceof ,但显然,行为会根据代码是在Node还是在Chrome运行而有所不同。 示例如下。 // file Actions.ts Class Action {..} Class ViewAction extends Action {..} Class MyViewAction extends ViewAction {..} // file App.ts var action = new MyViewAction(); // file App.ts or Elsewhere.ts foo(action) { var testA = action instanceof MyViewAction; var testB = (<any>action.constructor).name === "MyViewAction"; } 问题是,如果在不同的commonjs模块中调用foo,则如果在Node运行,则testA将变为false ,但如果在Chrome运行则为true ,而testB在两种情况下都为true 。 […]

Chrome,NodeJS和HTTPS

这是我的服务器端: var fs = require('fs'); var options = { key: fs.readFileSync('/cert.key'), cert: fs.readFileSync('/cert.crt') }; var app = require('express')(); var http = require('https').Server(options, app); var io = require('socket.io')(http); var port = 1234; app.get('/', function(req, res){ res.sendFile(__dirname + '/../subdomains/labs/socketio.html'); }); io.on('connection', function(socket){ socket.on('chat message', function(msg){ io.emit('chat message', msg); }); }); http.listen(port, function(){ console.log("\n\n——————————–"); console.log('Currently Listening on port […]

Node.js:如何在V8引擎中启用non strict或ECMASCRIPT3?

我相信V8底层Node.js默认支持严格模式或ES5。 我们可以在V8引擎中启用非严格或ECMASCRIPT 3吗? Chrome(V8)中几乎有100%的ES5function可用,请参阅兼容性表 。 但是一些开发人员(包括我)仍然对ES3感到满意,我们可以有这个select吗?