草庐IT

is_default_constructible

全部标签

javascript - Chrome 扩展中的 Require.JS : define is not defined

我正在尝试在我的chrome扩展程序中使用Requre.js。这是我的list:{"name":"myextension","version":"1.0","manifest_version":2,"permissions":["http://localhost/*"],"web_accessible_resources":["js/test.js"],"content_scripts":[{"matches":["http://localhost/*"],"js":["js/require.js","js/hd_init.js"]}]}hd_init.jsconsole.log("h

javascript - Jest : Mock ES6 Module with both default and named export

我有一个带有默认导出和命名导出的ES6模块:/**/src/dependency.js**/exportfunctionutilityFunction(){returnfalse;}exportdefaultfunctionmainFunction(){return'foo';}它被第二个ES6模块使用:/**/src/myModule.js**/importmainFunction,{utilityFunction}from'./dependency';//EDIT:Fixedsyntaxerrorincodesample//exportdefaultmyModule(){expor

javascript - "window.angular is undefined."使用 Protractor 进行自动化测试时?

我在使用Protractor提供的示例conf.js时似乎出错了。我正在使用grunt-protractor-runner运行测试,但即使使用提供的示例配置也会出错。我的Gruntfile.js看起来像这样:/*globalmodule:false*/module.exports=function(grunt){//Projectconfiguration.grunt.initConfig({protractor:{options:{configFile:"smoketest.conf.js",//DefaultconfigfilekeepAlive:false,//Iffalse,t

javascript - 使用 browserify,未捕获的 ReferenceError : function is not defined

我正在尝试http://browserify.org/中的示例并尝试按如下方式进行函数调用:我的html是:TestBrowserifytest我的javascript是:varunique=require('uniq');vardata=[1,2,2,3,4,5,5,5,6];console.log(unique(data));functionhello(){alert("here");}我做了browserifymain.js-obundle.js,所以我可以成功使用require。但是当我点击按钮时,出现错误:“UncaughtReferenceError:你好未定义”任何建议将

javascript - Chrome 扩展 "$ is not defined"错误

当我处理我的chrome扩展程序时,我收到错误“$isnotdefined”。这是我的list文件:{"name":"X","description":"Snipthispage","version":"2.0","permissions":["activeTab"],"background":{"scripts":["background.js"],"persistent":false},"content_scripts":[{"matches":[""],"js":["jquery-2.0.2.js","jquery.Jcrop.js"],"css":["jquery.Jcrop.

javascript - jqGrid 错误 - "Element is not a table"

这看起来很简单,但我从jqGrid代码中得到了这个神秘的错误,说“元素不是表格”。这是代码:vargrid_data=[{id:"1",invdate:"2007-10-01",name:"test",note:"note",amount:"200.00",tax:"10.00",total:"210.00"},{id:"1",invdate:"2010-05-24",name:"test",note:"note",tax:"10.00",total:"2111.00"},{id:"2",invdate:"2010-05-25",name:"test2",note:"note2",ta

javascript - ruby on rails javascript_include_tag :defaults

什么怎么的,哪里..这条邪恶的小线引入了3个额外的JavaScript,我基本上可以提供更少的东西。事实上,我想用它来重新定义每页的一些默认值。但是我似乎无法弄清楚这些默认值是在哪里定义的。我一直在google和bing上寻找答案,但我一无所获。我一直想出一个或3个文档来解释它的使用方法,但没有说明我如何使用它。 最佳答案 使用RailsAPIdocumentation为此。Iftheapplicationisnotusingtheassetpipeline,toincludethedefaultJavaScriptexpansio

javascript - THREE.js:错误消息 "THREE.OBJLoader is not a constructor"

我刚开始学习three.js的使用。看起来很好,但现在我有一个问题,我无法解决。我想加载一个OBJ文件,这是我之前在blender中创建的。为此,我正在尝试使用THREE.OBJloader。我从http://mamboleoo.be/learnThree/复制了代码,但我在第32行收到错误消息“THREE.OBJLoader不是构造函数”。其他一切正常:添加场景、添加Material、添加立方体等。为了简单起见,这是代码:varrenderer,scene,camera,banana;varww=window.innerWidth,wh=window.innerHeight;func

javascript - angularjs + ui 路由器 : redirect to login page when user is not logged in on each state change

我正在使用angularjs和ui-router构建一个简单的博客应用程序,我想监听每个状态变化并检查用户是否已登录。如果他没有登录,我想将他重定向到登录页面。场景非常简单,我试图实现thissolution没有运气。这是相关代码:app.config(function($stateProvider,$urlRouterProvider){$stateProvider.state('app',{url:'',abstract:true});$urlRouterProvider.otherwise('blogs');});app.run(function($rootScope,$stat

javascript - 在 meteor 中使用 spacejam 时出现 "fetch is not found globally and no fetcher passed"

我正在编写单元测试来检查我的api。在我将我的gittest分支与我的dev分支合并之前,一切都很好,但后来我开始遇到这个错误:Apprunningat:http://localhost:4096/spacejam:meteorisreadyspacejam:spawningphantomjsphantomjs:Runningtestsathttp://localhost:4096/localusingtest-in-consolephantomjs:Error:fetchisnotfoundgloballyandnofetcherpassed,tofixpassafetchforyo