草庐IT

the_menu

全部标签

javascript - 私有(private) NPM : How can the latest version of a module be installed?

使用私有(private)npm,常用命令似乎不起作用:npminstall没有特定的@version::issuenpmoutdated::issuenpmupdate::issuenpmviewversions::(还没有发现问题)还要注意npmv,npmshow,和npminfo是aliases这同样行不通我经常不知道我的团队维护的私有(private)模块的最新版本。我会求助于上面列出的命令之一,但它们似乎不起作用。如何在不知道最新版本的情况下安装软件包? 最佳答案 如果我理解你的问题,安装最新的软件包将是:npminsta

javascript - 使用: and => for the return type with a TypeScript function?有什么区别

我有以下代码:///functionaddThemePrototypes(){vartemplateSetup=newArray();$.fn.addTemplateSetup=function(func,prioritary){if(prioritary){templateSetup.unshift(func);}else{templateSetup.push(func);}};}有人能告诉我为什么要用=>void来声明吗?interfaceJQuery{addTemplateSetup:(func:Function,priority:bool)=>void;}我想我对如何从java

javascript - react : componentDidMount + setState not re-rendering the component

我对使用componentDidMount和setState来使用react并努力更新自定义组件相当陌生,这似乎是推荐的做法。下面是一个示例(包括用于获取数据的axiosAPI调用):importReactfrom'react';import{MyComponent}from'my_component';importaxiosfrom'axios';exportdefaultclassExampleextendsReact.Component{constructor(props){super(props);this.state={data:[]};}GetData(){returnax

javascript - 浏览器 "drag and drop"事件 : Can anyone fill in the blanks?

直到现在我才真正需要使用任何拖动功能,所以让我向您介绍一下我到目前为止的发现:拖动事件是在用户拖动对象时发生的事件。这是“正确的”操作系统拖动,例如:隐藏一些文本并拖动它,或者甚至从浏览器外部拖入某些内容。据我所知,拖动时不会触发其他浏览器事件。(例如,onmouseover被忽略)。唯一有效的事件是拖动事件。在所有现代浏览器中,onDragEnter和onDragOver似乎都可以工作...但firefox缺少“onDragLeave”。对于拖放,FF使用“onDragDrop”,而IE和其他使用“onDrop”,而Safari似乎不支持它。事件似乎只适用于“可放置”元素,例如文本区

javascript - 火狐插件 : adding icon to context menu

我正在尝试构建一个firefox插件,我想在右键单击内容菜单中添加图像/图标,例如,firebug在右键单击上下文菜单中有一个图标,我想做类似的事情,我的插件也包含菜单项我的插件在上下文菜单中的结构:[icon][menu][menuitem1][menuitem2][menuitem3][menuitem4]我该怎么做? 最佳答案 您必须设置imageattribute,给元素classmenu-iconic并存储图像以便您可以访问它。XUL:...JavaScript:您还可以动态设置或更改图像(首先获取对元素的引用):menu

javascript - 类型错误 : Failed to set the 'buffer' property on 'AudioBufferSourceNode' : The provided value is not of type 'AudioBuffer

我正在处理现有的codoCircle.调低音量。它按预期运行。现在我想在codepen中使用相同的代码我得到这个错误类型错误:无法在“AudioBufferSourceNode”上设置“缓冲区”属性:提供的值不是“AudioBuffer”类型我做了一些研究,找到了firstanswer有用。答案是当我在playSoundplayer.buffer=buffer中分配时,缓冲区仍未定义,因为加载回调尚未触发。这对我来说很有意义,所以我尝试做一个setTimeout像:setTimeout(playSound,9000);没有成功。你知道解决这个问题的方法吗?为什么在CodeCircle中

Javascript 权威指南 : the confusion of steps of converting object to a string

根据Javascript权威指南第6版3.8.3节:Toconvertanobjecttoastring,JavaScripttakesthesesteps:•IftheobjecthasatoString()method,JavaScriptcallsit.Ifitreturnsaprimitivevalue,JavaScriptconvertsthatvaluetoastring(ifitisnotalreadyastring)andreturnstheresultofthatconversion.Notethatprimitive-to-stringconversionsarea

javascript - "JavaScript - the Good Parts"示例的解释(第 4.15 节)?

JS初学者:)需要来自Crockford'sbook的代码片段的解释,第4.15节:varmemoizer=function(memo,fundamental){varshell=function(n){varresult=memo[n];if(typeofresult!=='number'){result=fundamental(shell,n);memo[n]=result;}returnresult;};returnshell;};varfibonacci=memoizer([0,1],function(shell,n){returnshell(n-1)+shell(n-2);}

javascript - ngrx : how the reducers function are invoked, 何时被调用?

我正在尝试使用ngrx库来管理我的应用程序的状态。我浏览了许多ngrx文档和git页面。我理解有三个重要的概念:商店Reducer和行动Store是我们应用程序的单一数据源。因此,对数据的任何修改或检索都是通过Actions完成的。我的问题是当一个Action被发送到商店时到底发生了什么?它如何知道要调用哪个reducer?它是否解析所有注册到商店的reducer?可以有多个同名的Action,在这种情况下会发生什么?提前致谢。 最佳答案 一图胜千言...来源:BuildingaReduxApplicationwithAngular

javascript - 道格拉斯克罗克福德的 "Javascript: The Good Parts"第 5.5 章

我正在阅读书名中的第5.5章。我仍然无法理解如何使用本章中的eventuality函数“我们可以用零件集组合对象”。对象是否由具有“on”和“fire”功能的事件系统组成?本书下面部分的代码:vareventuality=function(that){varregistry={};that.fire=function(event){//Fireaneventonanobject.Theeventcanbeeither//astringcontainingthenameoftheeventoran//objectcontainingatypepropertycontainingthe//