mirror of
https://github.com/laurent22/joplin.git
synced 2024-12-24 10:27:10 +02:00
async/await
This commit is contained in:
parent
f0aa00945e
commit
601ec12ee8
@ -1,3 +1,4 @@
|
||||
{
|
||||
"presets": ["env", "react"]
|
||||
"presets": ["env", "react"],
|
||||
"plugins": ["syntax-async-functions","transform-runtime"]
|
||||
}
|
@ -1,4 +1,6 @@
|
||||
require('source-map-support').install();
|
||||
//require("babel-polyfill");
|
||||
require('babel-plugin-transform-runtime');
|
||||
|
||||
import { FileApi } from 'src/file-api.js';
|
||||
import { FileApiDriverLocal } from 'src/file-api-driver-local.js';
|
||||
@ -46,34 +48,32 @@ function createRemoteItems() {
|
||||
});
|
||||
}
|
||||
|
||||
function createLocalItems() {
|
||||
return Folder.save({ title: "folder1" }).then((f) => {
|
||||
return Promise.all([
|
||||
Note.save({ title: "un", parent_id: f.id }),
|
||||
Note.save({ title: "deux", parent_id: f.id }),
|
||||
Note.save({ title: "trois", parent_id: f.id }),
|
||||
Note.save({ title: "quatre", parent_id: f.id }),
|
||||
]);
|
||||
}).then(() => {
|
||||
return Folder.save({ title: "folder2" })
|
||||
}).then((f) => {
|
||||
return Promise.all([
|
||||
Note.save({ title: "cinq", parent_id: f.id }),
|
||||
]);
|
||||
}).then(() => {
|
||||
return Folder.save({ title: "folder3" })
|
||||
}).then(() => {
|
||||
return Folder.save({ title: "folder4" })
|
||||
}).then((f) => {
|
||||
return Promise.all([
|
||||
Note.save({ title: "six", parent_id: f.id }),
|
||||
Note.save({ title: "sept", parent_id: f.id }),
|
||||
Note.save({ title: "huit", parent_id: f.id }),
|
||||
]);
|
||||
});
|
||||
async function createLocalItems() {
|
||||
let folder = await Folder.save({ title: "folder1" });
|
||||
await Note.save({ title: "un", parent_id: folder.id });
|
||||
await Note.save({ title: "deux", parent_id: folder.id });
|
||||
|
||||
folder = await Folder.save({ title: "folder2" });
|
||||
await Note.save({ title: "trois", parent_id: folder.id });
|
||||
|
||||
// let folder = await Folder.save({ title: "folder1" });
|
||||
// await Note.save({ title: "un", parent_id: folder.id });
|
||||
// await Note.save({ title: "deux", parent_id: folder.id });
|
||||
// await Note.save({ title: "trois", parent_id: folder.id });
|
||||
// await Note.save({ title: "quatre", parent_id: folder.id });
|
||||
|
||||
// folder = await Folder.save({ title: "folder2" });
|
||||
// await Note.save({ title: "cinq", parent_id: folder.id });
|
||||
|
||||
// folder = await Folder.save({ title: "folder3" });
|
||||
|
||||
// folder = await Folder.save({ title: "folder4" });
|
||||
// await Note.save({ title: "six", parent_id: folder.id });
|
||||
// await Note.save({ title: "sept", parent_id: folder.id });
|
||||
// await Note.save({ title: "huit", parent_id: folder.id });
|
||||
}
|
||||
|
||||
db.setDebugEnabled(true);
|
||||
db.setDebugEnabled(!true);
|
||||
db.open({ name: '/home/laurent/Temp/test-sync.sqlite3' }).then(() => {
|
||||
BaseModel.db_ = db;
|
||||
//return clearDatabase();
|
||||
@ -87,6 +87,21 @@ db.open({ name: '/home/laurent/Temp/test-sync.sqlite3' }).then(() => {
|
||||
|
||||
|
||||
|
||||
// function testingProm() {
|
||||
// return new Promise((resolve, reject) => {
|
||||
// setTimeout(() => {
|
||||
// resolve('mavaler');
|
||||
// }, 2000);
|
||||
// });
|
||||
// }
|
||||
|
||||
// async function doSomething() {
|
||||
// let val = await testingProm();
|
||||
// console.info(val);
|
||||
// }
|
||||
|
||||
// doSomething();
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -4,6 +4,8 @@
|
||||
"private": true,
|
||||
"dependencies": {
|
||||
"app-module-path": "^2.2.0",
|
||||
"babel-plugin-transform-runtime": "^6.23.0",
|
||||
"babel-polyfill": "^6.1.4",
|
||||
"form-data": "^2.1.4",
|
||||
"fs-extra": "^3.0.1",
|
||||
"jssha": "^2.3.0",
|
||||
@ -12,6 +14,7 @@
|
||||
"moment-timezone": "^0.5.13",
|
||||
"node-fetch": "^1.7.1",
|
||||
"promise": "^7.1.1",
|
||||
"query-string": "4.3.4",
|
||||
"react": "16.0.0-alpha.6",
|
||||
"sax": "^1.2.2",
|
||||
"source-map-support": "^0.4.15",
|
||||
@ -26,8 +29,10 @@
|
||||
"babel-cli": "^6.24.1",
|
||||
"babel-preset-env": "^1.5.1",
|
||||
"babel-preset-react": "^6.24.1",
|
||||
"jasmine": "^2.6.0",
|
||||
"query-string": "4.3.4"
|
||||
"babel-plugin-syntax-async-functions": "^6.1.4",
|
||||
"babel-plugin-transform-regenerator": "^6.1.4",
|
||||
"babel-preset-es2015": "^6.1.4",
|
||||
"jasmine": "^2.6.0"
|
||||
},
|
||||
"scripts": {
|
||||
"babelbuild": "babel app -d build",
|
||||
|
Loading…
Reference in New Issue
Block a user