jjzjj

initial-time

全部标签

javascript - this.initialize(arguments) 与 this.initialize.apply(this, arguments) : what's the difference?

如果您查看Backbone.js的源代码,您会看到此模式的多种用途:this.initialize.apply(this,arguments);例如,这里:varRouter=Backbone.Router=function(options){options||(options={});if(options.routes)this.routes=options.routes;this._bindRoutes();this.initialize.apply(this,arguments);};为什么不直接写this.initialize(arguments)呢?

javascript - 传单 : Map container is already initialized does not get solved by proposed answers

我正在尝试使用传单加载map。当我刷新map时,出现上述错误。我研究了这个问题的其他建议答案。但是,他们中没有一个对我有用。我正在尝试在由onclick事件运行的函数中加载map。这是代码:functionload_map_and_analyze_data(){varmymap=L.map('mapid',{center:newL.LatLng(the_center_splitted[0],the_center_splitted[1]),maxZoom:17,minZoom:11,zoom:14});//creatingthemap//therestofanalyzeandcodego

Javascript Promises : Chain same promise n times, 然后做其他事情

我有一个返回promise的函数,它执行一些异步操作,我们称它为functionToRepeat()。我正在尝试编写函数repeatFunction(amount),这样它将启动promise,等待完成,再次启动,等待完成,等等给定的次数.这个repeatFunction(amount)也应该是thenable,这样我就可以在它执行后链接其他东西。这是我的尝试:functionfunctionToRepeat(){letaction=newPromise(function(resolve,reject){setTimeout(function(){console.log("resolv

javascript - Angular Directive(指令) : Adding ng-class directive at compile time on existing template element

长话短说,这个想法是通过不必手动添加ng-class={'has-error':'formName.inputName.$invalid'}来简化模板每一个form-group所以我想创建一个指令来生成一个字符串,该字符串将被添加到模板元素中。该字符串是一个带有表达式的ng-class属性我认为创建一个在编译阶段添加ng-class属性的快速指令就足够了,但它似乎并没有削减它。指令定义对象{restrict:'C',compile:function(tElement,tAttrs){var$elem=angular.element(tElement),formName=$elem.pa

javascript - 创建一个 Ahead-of-Time (AOT) 编译库供 Angular 应用程序使用

我有一个Angular5库,我将它公开为一个包,供其他应用从它们的node_modules使用。目前,该应用程序使用rollup和gulp进行即时(JIT)编译,并作为包导出。因此,开发人员应用程序以其JIT编译形式使用我的包。对AOT的研究让我相信,任何使用AOT编译的Angular应用程序都比浏览器上的JIT对应程序具有更高的性能。但是,作为库开发人员,我想知道如果我公开AOT编译的库,应用开发人员是否会获得任何性能优势?我使用ng-bootstrap和许多其他开源库在我的模块中创建组件并在它们之上添加自定义样式或功能。我在模块中使用的所有库是否也需要采用AOT形式,或者我可以使用

javascript - 量子对偶性 : variable is null and undefined at the same time?

考虑以下JavaScript代码(在Firefox中测试):functionf(a){if(a==undefined){alert('undefined');}if(a==null){alert('null');}}f();同时显示两个警报,表明这两个陈述都是正确的。你能给出一个合理的解释吗? 最佳答案 ==是一个“软”相等运算符。它使用类型强制将两个等效对象比较为相等。以下所有都是正确的:42=="42"0==false0==""[]==""{}=="[objectObject]"'/(?:)/'==newRegExp相反,您应该

javascript - Learnyounode #6 使其模块化 : correct results AND throwing error at the same time?

我正在完成nodeschool.iolearnyounode练习#6,makeitmodular。我得到了正确的结果,但仍然有一段我不熟悉的代码出错。任何帮助都会很棒。这是结果和错误:Yoursubmissionresultscomparedtotheexpected:ACTUALEXPECTED────────────────────────────────────────────────────────────────────────────────"CHANGELOG.md"=="CHANGELOG.md""LICENCE.md"=="LICENCE.md""README.md"

javascript - Facebook 错误 100 : You cannot specify a scheduled publish time on a published post

我只是不得不这样做。绝对每个问题我都查找了有关此问题的问题,但他们的答案都没有帮助我解决问题。我正在尝试在我的Facebook页面上发帖。问题是:错误:“(#100)您不能在已发布的帖子上指定预定的发布时间”代码:FB.api("/100177680105780/feed","POST",{"message":"Thisisatestmessage","scheduled_publish_time":Math.round(newDate().getTime()/1000)+120},function(response){console.log(response);if(response

javascript - CucumberJS - 错误 : Step timed out after 5000 milliseconds at Timer. listOnTimeout (timers.js:92:15)

我是cucumberjs的新手,只是第一次尝试运行一个功能。我已经构建了cucumber-jsgithubpage上的功能.尝试运行时出现此错误:Benjamins-MBP:FeaturesBen$cucumber.jsexample.featureFeature:ExamplefeatureAsauserofcucumber.jsIwanttohavedocumentationoncucumberSothatIcanconcentrateonbuildingawesomeapplicationsScenario:Readingdocumentation#example.feature

javascript - 谷歌地图 JS v3 : Map display: none; after map initialization causing corrupted map

这当然涉及到之前关于初始化期间map显示的问题。然而这里的问题是在map应该已经初始化之后map显示被设置为无。我的widow.onload的最后一行将map设置为显示:无;到那时map初始化应该已经完成​​,但事实仍然是最终调用导致了问题。window.onload();函数...window.onload=function(){changeTheme(me);//doitnowsocurrent_themeisavaibletoswitchTabs();switchTabs("tab3");//setsmapdivvisibleinitMaps();//mapinitializat