草庐IT

not_matched

全部标签

javascript - Socket.configure Undefined is not a function 错误

注意:我使用的是MacOS10.10Yosemite重要说明:其他问题和答案均对我无效。我正在学习教程,这样我就可以玩多人游戏了。有一个文件,我必须下载,其中有一个game.js文件,我需要将此代码添加到:注意:我在正确的目录中正确下载了socket.io。varutil=require("util"),io=require("socket.io").listen(80);varsocket,players;functioninit(){players=[];socket=io.listen(8000);socket.configure(function(){socket.set("t

javascript - react + 终极版 : "<Provider> does not support changing ` store` on the fly"

我收到这个错误:doesnotsupportchangingstoreonthefly.ItismostlikelythatyouseethiserrorbecauseyouupdatedtoRedux2.xandReactRedux2.xwhichnolongerhotreloadreducersautomatically.Seehttps://github.com/reactjs/react-redux/releases/tag/v2.0.0forthemigrationinstructions.我有一个组件:importReact,{Component}from'react';i

javascript - 为什么这不是 google.maps.Map 的 map 实例?无效值错误 : setMap: not an instance of Map;

我收到错误Assertionfailed:InvalidValueError:setMap:notaninstanceofMap;而不是谷歌地图网页上StreetViewPanorama的实例。然后我读了thisquestionStackOverflow上的其他地方告诉我我需要一个google.maps.MAP对象的实例。我认为通过调用该对象来初始化我将调用该对象的map。以前,我收到错误iisnotdefined所以我将createMarker函数移动到$.getJSON函数中,它有本地范围。我需要在其他地方调用google.mapsMap吗?我做错了什么?HTML:HelloWor

javascript - "Warning: Task "巴别塔 "not found. Use --force to continue."

我的gruntfile.js中有这个简单的代码:module.exports=function(grunt){require("load-grunt-tasks")(grunt);//npminstall--save-devload-grunt-tasksgrunt.initConfig({babel:{options:{sourceMap:true},dist:{files:{"dist/app.js":["src/app.js"]}}}});grunt.registerTask("default",["babel"]);};但是运行时显示这个错误:Warning:Task"babe

javascript - 将逻辑 NOT 应用于 propEq 并在 ramda 中进行过滤

我正在尝试使用Ramda进行函数式编程我正在努力做一些听起来应该很容易的事情。我想要数组中属性不等于某个值的所有条目。例如纯jsconstfiltered=source.filter(entry=>entry.name!=='something');在Ramda中有一个propEq所以我可以很容易地得到所有匹配一个值的元素,比如constfiltered=R.filter(R.propEq('name','something'),source);但我看不出如何做相反的操作,只返回不等于某个值的值。我敢肯定这一定很容易,但我很难看到一个内置函数来做到这一点,我能想到的最接近的是:cons

javascript - JS 和 type.match 作为文件 mime 类型 - 需要建议

今天我遇到了一个有趣的事情,如FFFileAPI和按类型分隔文件。好的,这是一个小片段作为if(!input.files[0].type.match('image.*')){window.alert("Selectimageplease");return;}它控制图像只读。但是,例如doc文件和pdf呢?我找不到有用的例子,所以我希望你能分享一些片段。我感兴趣的是检测不同的文件类型,但如何使用JS及其type.match绑定(bind)来控制不同的文件类型?Here是基础代码感谢任何有用的评论:) 最佳答案 所以基本思想是此代码使用

javascript - 如何制作 `where not` 大小写?

我需要where但not大小写。例如,我想找到没有名字“莎士比亚”的戏剧:_.where(listOfPlays,{author:!"Shakespeare",year:1611});^^^^^^^^^^^^^NOTShakespeare如何使用underscore来实现? 最佳答案 _.filter(listOfPlays,function(play){returnplay.author!=='Shakespeare'&&play.year===1611;});http://underscorejs.org/#filterwher

javascript - 扩展EventEmitter时如何解析 'this is not defined'?

这个问题在这里已经有了答案:"UncaughtReferenceError:thisisnotdefined"inclassconstructor(1个回答)关闭6年前。以下代码失败:varEventEmitter=require('events');classFooextendsEventEmitter{constructor(){this.name='foo';}print(){this.name='hello';console.log('world');}}varf=newFoo();console.log(f.print());并打印错误this.name='foo';^Ref

javascript - 为什么 push 显示 argument of type 'any[]' is not assignable to parameter of type 'never' 错误?

在这段代码中我得到了休闲错误:Argumentoftype'any[]'isnotassignabletoparameteroftype'never'varmarkers:[];this.Getlapoints(this.map.getCenter(),500000).then(data=>{for(varkeyindata){Leaflet.marker(data[key].location,//{icon:greenIcon}).addTo(this.map).bindPopup(data[key].caption);//markers.push(data[key].locatio

Javascript 正则表达式 .match() 为空

console.log(r.message);//returns"Thistransactionhasbeenauthorized"if(r.message.match(/approved/).length>0||r.message.match(/authorized/).length>0){//^throwstheerror:r.message.match(/approved/)isnull这不是在JavaScript中进行匹配的正确方法吗?success:function(r){$('.processing').addClass('hide');if(r.type=='succes