草庐IT

system-variable

全部标签

javascript - 文件 API : Directories and System -- discontinued. .. 这是什么意思?

我知道了,截至2014年4月24日http://dev.w3.org/2009/dap/file-system/pub/FileSystem/在FileAPI上的工作已经停止。这就提出了两个问题:1.createObjectURL()读取本地文件有什么影响吗?(我想不会,因为这似乎被广泛实现)2.假设有人想将Web应用程序(如绘图程序)的输出本地保存到文件中。如何做到这一点以及4月24日的声明是否对实现这一目标的能力有影响。 最佳答案 我认为您可能误读了该声明。FileApi并没有停产,只是一个文件被打折了。看这里:http://d

javascript - 如何检查 ES6 "variable"是否不变?

有谁知道一些技巧如何做到这一点?我尝试使用try-catch:"usestrict";consta=20;varisConst=false;try{vartemp=a;a=a+1;a=temp;}catch(e){isConst=true;}但不幸的是,它只能在“严格”模式下工作。如果不使用“usestrict”,它会静默执行所有语句,而不会修改a。此外,我无法将此代码包装到一些方便的函数中(例如isConstant(someConst)),因为我将传递给该函数的任何参数都将是一个新变量。所以有人知道如何创建isConstant()函数吗? 最佳答案

javascript - 无法动态转译 ES 模块 System.config({ transpile : 'transpile-module' })

这是我的tsconfig.js{"compilerOptions":{"experimentalDecorators":true,"emitDecoratorMetadata":true,"moduleResolution":"node","target":"es5","module":"system","noImplicitAny":false,"outDir":"built","rootDir":".","sourceMap":false},"exclude":["node_modules"]我正在使用tsc命令将我的“hello-angular.ts”转译为“hello-angu

javascript - 引用错误 : Can't find variable: exports

问题:为什么会出现以下错误?我是否忘记在我的html中包含脚本?ReferenceError:Can'tfindvariable:exports从导致它的typescript生成的javascript:"usestrict";Object.defineProperty(exports,"__esModule",{value:true});/*morecode*/额外:tsconfig.json{"compileOnSave":true,"compilerOptions":{"target":"es5","noImplicitAny":true,"rootDir":".","source

javascript - 为什么 typescript 不提示某些 undefined variable

我有以下示例:classUncle{constructor(publicname:string){}talk(){return"Hellomynameis"+name;}}letp:Uncle=newUncle("Jo");console.log(p.talk());对于某些变量名,typescript(目前版本2.1.4)不会提示它们没有在您的程序中定义(在方法讨论中,名称是在没有这个的情况下使用。)。name就是其中之一。如果我将变量重命名为firstName,编译器会正确地提示...errorTS2663:Cannotfindname'firstName'.Didyoumeant

javascript - JavaScript 中全局作用域中存在 undefined variable 的原因是什么?

我发现很多关于undefined作为值的讨论,例如如何检查是否相等等等。但是undefined作为全局变量存在的“工程”原因是什么?对面没有null变量...console.log(undefinedinthis);//logstrueconsole.log(nullinthis);//logsfalse 最佳答案 在JavaScript中,null是一个保留字;undefined不是,但由环境实现作为一个全局变量,其值为undefined。您会注意到您可以更改undefined的值,但不能更改null的值,except严格模式(会

javascript - 如何在 Chrome 打包应用程序的 list 中使用 "system_indicator"?

我正在尝试创建一个在系统菜单栏中带有图标的Chrome包应用程序,如下所述:https://docs.google.com/document/d/1QhhfR33Y28Yqnnoa_Sl3fnZK_mKtwt4dZe6kNyJ_MjU/edit,GoogleHangout应用程序可以实现此功能(这不是完全相同的行为),但我找不到任何好的文档来执行相同的操作。在GooglePackagedApp的manifest页面中,我们可以看到“system_indicator”字段。是我要找的吗?当我尝试将此字段设置为图标的url时,Chrome返回此错误:'system_indicator're

javascript - 未捕获的类型错误 : System. 导入不是函数

这段代码应该显示一个包含HelloWorld的div,但我却收到错误UncaughtTypeError:System.importisnotafunction。我正在观看ng-book2的入门教程视频,其中在index.html中包含以下代码:Angular2System.import('js/app');和app.ts:///import{Component,View,bootstrap}from'angular2/angular2';//Annotationsection@Component({selector:'hello-world'})@View({template:'Hel

javascript - 中级 JavaScript : assign a function with its parameter to a variable and execute later

我有一个JavaScript函数:functionalertMe($a){alert($a);}我可以这样执行:alertMe("Hello");我想做的是将带有"Hello"参数的alertMe("Hello")赋给一个变量$func,然后稍后可以通过执行$func();之类的操作来执行此操作。 最佳答案 我想添加评论作为答案代码//definethefunctionfunctionalertMe(a){//returnthewrappedfunctionreturnfunction(){alert(a);}}//declaret

Javascript/Jquery : Mathematically Divide Two Variables

这是我的代码:varframeWidth=400;varimageWidth=$('#inner-image').css('width');varnumberOfFrames=imageWidth/frameWidth;如何使“numberOfFrames”显示为商数?IE。将“frameWidth”和“imageWidth”处理为数字,而不是对象?如果我需要更清楚地解释自己,请告诉我。谢谢! 最佳答案 .css('width')可能返回带有px的值。您可以使用parseInt()只获取数字。varframeWidth=400;va