如何下载和加载脚本文件? [英] how to download and load a script file?

查看:436
本文介绍了如何下载和加载脚本文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

教程的列表之后,我需要创建一个TS文件.我已经按照本教程中的所有内容(以及之前的所有16部分,使用果园cms创建日历)

following a list of tutorials, I need to create a TS file. I have followed everything in this tutorial (and all the previous 16, on creating a calendar using orchard cms)

因此,如果您观看视频中的 4.49 ,Ron会说明去下载JQuery(作为参考).因此,他告诉我们(但没有向我们展示)从此处下载jquery.d.ts文件,然后将其插入到项目中.

So if you look at 4.49 on the video where Ron explains to go and download the JQuery (which is needed as a ref). So he tells us (but doesnt show us) to download the jquery.d.ts file from here and then insert it into the project.

这一切都很好,但是我找不到在哪里下载它. 如果我单击jquery.d.ts,则文本文档类型格式将在屏幕上显示该文件.因此,我尝试将文本复制到文件中,并将其保存到本地他在视频中提到的位置.

This is all fine but I cant find no where to download it. If i click on jquery.d.ts a text document type format displays the file on screen. So I'v tried copying the text to a file and saving it locally, to the location he mentions on the video.

但是这会引发50多个错误...因此我猜这是不正确的.谁能告诉我如何在我的项目中正确加载此文件?

But this throws over 50 errors...so im guessing this isn't correct. can anyone tell me how to correctly load this file in my project?

谢谢

编辑

好的,非常感谢您到目前为止提供的帮助...我没有意识到点击原始文件下载了该文档.所以它的d/l并放置在与教程相同的位置,并且我遇到了很多错误.....例如

ok so thanks for the help so far guys...I didnt realise clicking raw downloaded the doc. so its d/l and placed into the same location as the tutorial and I am getting a number of errors.....for example

async?: boolean; //boolean is flagging up as: any: the name boolean does not exist in the current scope.
interface JQueryXHR extends XMLHttpRequest, JQueryPromise<any> { //JQueryPromise does not exist in the current scope

//then there are a number of functions:
interface JQueryGenericPromise<T
interface JQueryPromise<T> {
interface JQueryDeferred<
etc...//all saying duplicate identifier interface expected ;


declare var jQuery: JQueryStatic;//the name JQueryStatic does not exist in the current scope

请记住,此内容是按原样下载的.我什么都没改变. 谢谢大家的回复

bear in mind this is downloaded as it is. I have no changed anything. thank you for any replies guys

推荐答案

在GitHub上,您可以点击原始"按钮,该按钮通常会下载文件.

On GitHub you can hit the "Raw" button, which normally downloads the file.

https://raw.github.com/borisyankov/绝对是typed/master/jquery/jquery.d.ts

否则,您可以将文本复制并粘贴到文件中,然后将其另存为jquery.d.ts

Failing that, you can copy and paste the text into a file and then save it as jquery.d.ts

如果您仍然有错误,请共享它们,我们将帮助您修复它们.最有可能的是,如果您使用的是TypeScript的较早版本-jQuery定义已针对TypeScript 0.9进行了更新

If you still have errors, share them and we'll help you to fix them. The most likely would be if you are using an older version of TypeScript - the jQuery definition is updated for TypeScript 0.9

更新

这几乎就是我的想法-boolean类型是TypeScript 0.9的新功能,它取代了TypeScript 0.8中的bool类型.

It is pretty much what I thought - the boolean type is new to TypeScript 0.9 and replaces the bool type from TypeScript 0.8.

您需要...

A.获取最新版本的TypeScript -它会识别出boolean类型

A. Get the latest version of TypeScript - it will then recognise the boolean type

B.从之前获取旧版本的jQuery定义文件它已更新为0.9

B. Get an older version of the jQuery definition file from before it was updated for 0.9

这篇关于如何下载和加载脚本文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆