updated browser docs

This commit is contained in:
Daniel Lang 2017-09-16 20:10:26 +02:00
parent 8968397bf2
commit 4e541cd0d4
4 changed files with 25 additions and 7 deletions

View File

@ -120,12 +120,11 @@ You'll also need to enable `es6` in the `lib` section of compiler options, or in
TypeORM was tested with Node.js version 4 and above.
If you have errors during app bootstrap, try to upgrade your Node.js version to the latest version.
#### Usage in the browser with WebSQL (experimental)
#### Usage in the browser with WebSQL (experimental) or in a Cordova/Phonegap/Ionic app
TypeORM works in the browser and has experimental support of WebSQL.
If you want to use TypeORM in the browser then you need to `npm i typeorm-browser` instead of `typeorm`.
More information about it is in [this page](https://typeorm.github.io/usage-in-browser.html).
Also take a look at [this sample](https://github.com/typeorm/browser-example).
TypeORM works in the browser and has experimental support of WebSQL and supports the [cordova-sqlite-storage](https://github.com/litehelpers/Cordova-sqlite-storage) plugin for Cordova/Phonegap/Ionic.
More information about how to install and use TypeORM in the browser or an app can be found in the [docs](docs/usage-in-the-browser-and-cordova.md).
Also take a look at the [browser](https://github.com/typeorm/browser-example) and [cordova](https://github.com/typeorm/cordova-example) example.
## Quick start

View File

@ -6,7 +6,7 @@ Its all possible with TypeORM:
* write code in TypeScript or JavaScript
* works on node.js / browser / ionic / electron platforms [TBD]
* supports mysql / mariadb / postgres / sqlite / sql server / oracle / websql / sqljs [TBD]
* supports mysql / mariadb / postgres / sqlite / sql server / oracle / websql / sqljs
* supports all data types your database support
* schema configuration using decorators / json / xml / yml files
* you produce performant, flexible, clean and maintainable code using it

View File

@ -0,0 +1,19 @@
# Usage in the browser and Cordova
The standard `typeorm` package also supports browser usage and can also be used in cordova based projects (cordova, phonegap, ionic).
The package includes two ways to use in the browser
## SystemJS
If you want to use SystemJS as a module loader than three precompiled files are included for you to use.
```
- typeorm-browser.js
- typeorm-browser.min.js (Minified version)
- typeorm-browser.js.map (Sourcemap)
```
Since these files are generated by the TypeScript compiler they are affected by the [issue, that SystemJS 0.20 does not support them](https://github.com/systemjs/systemjs/issues/1587). When using SystemJS@0.19.47 everything works.
For an example see [typeorm/browser-example](https://github.com/typeorm/browser-example).
## ES2015 Module
In the `browser` folder the package also includes a version compiled as a ES2015 module. If you want to use a different loader this is the point to start. The package is setup in a way that loaders like webpack will automatically use the `browser` folder.
## Cordova/Phonegap
Thanks to the [cordova-sqlite-storage](https://github.com/litehelpers/Cordova-sqlite-storage) plugin, TypeORM can also run in a Cordova or Phonegap app, where you again have the option to choose between module loaders. For an example see [typeorm/cordova-example](https://github.com/typeorm/cordova-example).

View File

@ -141,7 +141,7 @@ export class Gulpfile {
*/
@Task()
browserUglify() {
return gulp.src("./build/browser/typeorm-browser.js")
return gulp.src("./build/package/typeorm-browser.js")
.pipe(uglify())
.pipe(rename("typeorm-browser.min.js"))
.pipe(gulp.dest("./build/package"));