> For the complete documentation index, see [llms.txt](https://narro.gitbook.io/tinyts-handbook-cn/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://narro.gitbook.io/tinyts-handbook-cn/master.md).

# 项目说明

## 配置

1. 配置nodejs 5.x 版本环境
   1. windows
      1. 下载[nodejs](https://nodejs.org/en/download/releases/)安装包
      2. 运行安装即可
2. 安装[typescript](http://www.typescriptlang.org/docs/tutorial.html).(npm install typescript)

### 使用nresource构建项目

1. 安装 [nresource](https://github.com/narrowizard/nresource) 项目.
2. 在以下目录创建你的项目`{nresource root}/content/project/{your project}` directory. 如: `/home/node/nresource/content/project/demo`.
3. 在项目下使用npm安装 tinyts 框架.(npm install tinyts) [npm教程](http://www.runoob.com/nodejs/nodejs-npm.html)
4. 编写viewmodel代码,目录如下 `{your project}/viewmodels/{your viewmodel}`.如: `/home/node/nresource/content/project/demo/viewmodels/demo.ts`.
5. 在html页面上使用script标签引用你的viewmodel. 引用路径如下: `{你的服务端主机名}/tinyts/{项目名}/{viewmodel路径}`。 &#x20;

   例如，你在自己的计算机上运行了nresource，并且在nresource/content/project/demo/viewmodels路径下建立了一个文件名为demo.ts的文件,文件路径如下： &#x20;

   ![nresource/content/project/demo/viewmodels/demo.ts](https://1916544744-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LtcwvClpzoWhhG-e46G%2F-LtcwwFKLVOA1EDvE7mh%2F-LtcwyfQdtCx-yo-L4Yk%2Fdemo%E8%B7%AF%E5%BE%84.jpg?generation=1573718848051189\&alt=media) &#x20;

   并在这个文件中编写了viewmodel的代码,其中project下的demo文件夹表示项目名为demo,而viewmodels文件夹下的demo.ts表示你的viewmodel名称为demo. &#x20;

   你的引用路径就是: `http://localhost:8124/tinyts/demo/demo.js`. &#x20;

   ![\<script src="http://localhost:8124/tinyts/demo/viewmodels/demo.js">\</script>](https://1916544744-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LtcwvClpzoWhhG-e46G%2F-LtcwwFKLVOA1EDvE7mh%2F-LtcwyfSd1kBcZ99Jsb-%2Fdemo%E5%BC%95%E7%94%A8%E8%B7%AF%E5%BE%84.jpg?generation=1573718847109899\&alt=media)

### 构建原生项目

1. 创建你的项目.
2. 在项目下使用npm安装tinyts框架.(npm install tinyts)
3. 编写项目代码.
4. 将ts代码[编译](http://www.typescriptlang.org/docs/tutorial.html)成js代码.
   1. 使用[命令行](http://www.typescriptlang.org/docs/tutorial.html)编译.
   2. 使用支持的IDE编译.(如:[Visual Studio Code](https://code.visualstudio.com/docs/languages/typescript))
5. 在html中引用你的js代码.

## 项目依赖

1. [requirejs](http://requirejs.org/)
2. [jquery](https://jquery.com/)
3. [linqjs](https://github.com/mihaifm/linq)

## 浏览器支持

### 在一些较老的浏览器上(不支持es5),需要引用[es5 shim](https://github.com/es-shims/es5-shim).

### 以下功能只在现代浏览器被支持(IE9+,ff,chrome等)

1. router
2. file uploader
