本文整理汇总了TypeScript中ionic-angular.Storage类的典型用法代码示例。如果您正苦于以下问题:TypeScript Storage类的具体用法?TypeScript Storage怎么用?TypeScript Storage使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Storage类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。
示例1: constructor
constructor(public nav: NavController,
public view: ViewController,
public translate: TranslateService) {
this.local = new Storage(LocalStorage);
var userLang = navigator.language.split('-')[0];
userLang = /(de|en|hr)/gi.test(userLang) ? userLang : 'en';
this.local.get('language')
.then((l) => {
if (l) {
this.language = l;
} else {
this.language = userLang;
}
});
}
开发者ID:quanganh206,项目名称:ionic2-kitchen-sink-ts,代码行数:15,代码来源:settings.ts
示例2: constructor
constructor(private navCtrl: NavController, private navParams: NavParams, private loadingCtrl: LoadingController, private modalCtrl: ModalController) {
this.global = this.navParams.get('global');
this.sku = this.navParams.get('sku');
this.name = this.navParams.get('name');
this.slideOptions = {
autoplay: 2000,
loop: true,
pager: true
};
this.global.subData = {};
this.global.isLoaded = false;
let loader = this.loadingCtrl.create({
content: this.global.message.pleaseWait+"...",
});
loader.present();
var timer = setInterval(() => {
if(this.global.isLoaded) {
clearInterval(timer);
loader.dismiss();
}
}, 500);
let storage = new Storage(LocalStorage);
storage.get('token').then((token) => {
this.global.socket.emit('api', {
token: token,
module: 'product',
action: 'info',
sku: this.sku
});
});
}
开发者ID:RemaxThailand,项目名称:RemaxMobile,代码行数:36,代码来源:product.ts
示例3: logout
logout() {
localStorage.removeItem('appKey');
localStorage.removeItem('appSecret');
localStorage.removeItem('consumerKey');
localStorage.removeItem('widgets');
localStorage.removeItem('credentials');
localStorage.removeItem('connected');
this.ovhRequest.setConfiguration({});
return this.nav.setRoot(LoginPage);
}
开发者ID:SCORE42,项目名称:my-infra,代码行数:11,代码来源:login.service.ts
示例4: function
global.socket.on('access', function (data) {
if (data.success) {
storage.set('token', data.token);
global.socket.emit('api', {
token: data.token,
module: 'system',
action: 'language',
system: 'mobile',
langCode: global.langCode
});
global.socket.emit('api', {
token: data.token,
module: 'system',
action: 'screen'
});
//-- ข้อมูลจำนวนสินค้าในรถเข็น --//
global.socket.emit('api', {
token: data.token,
module: 'cart',
action: 'summary'
});
}
else {
storage.remove('token');
if (retryCount < 3) {
global.socket.emit('access', { token: '' });
retryCount++;
}
else {
alert(data.error + "\n" + data.errorMessage);
}
}
});
开发者ID:RemaxThailand,项目名称:RemaxMobile,代码行数:36,代码来源:app.ts
示例5: getTasks
getTasks(){
let sql = `SELECT * from tasks`;
return this.tasks.query( sql )
.then(response =>{
let data = [];
for (let index = 0; index < response.res.rows.length; index++) {
data.push({
id: response.res.rows[index].id,
title: response.res.rows[index].title,
completed: response.res.rows[index].completed == "true" ? true : false
});
}
return Promise.resolve(data);
});
}
开发者ID:EscuelaIt,项目名称:class7-ionic-2,代码行数:15,代码来源:tasks-websql.ts
示例6: save
save(data): void {
let saveData = [];
//Remove Observables
data.forEach((checklist) => {
saveData.push({
title: checklist.title,
items: checklist.items,
createdOn: checklist.createdOn
});
});
let newData = JSON.stringify(saveData);
this.storage.set('checklist', newData);
}
开发者ID:digitaldrummerj,项目名称:ionic2-book-quicklist,代码行数:15,代码来源:data.ts
示例7: Promise
return new Promise((resolve, reject) => {
//this.platform.ready().then(() => {
/*this.storage.query('CREATE TABLE IF NOT EXISTS data (key TEXT PRIMARY KEY, value TEXT)').then((data) => {
this.storage.query("INSERT OR IGNORE INTO data (key, value) VALUES " +
"('familias', '')," +
"('likes', '')," +
"('entity', '')," +
"('user', '')," +
"('tiposElementos', '')," +
"('tiposIncidencias', '')," +
"('estados', '')," +
"('responsables', '')," +
"('firstRun', '')," +
"('language', '');").then((data) => {
resolve(data);
}, (error) => {
//reject("ERROR -> " + error);
console.log(error);
});
}, (error) => {
//reject("ERROR -> " + error);
console.log(error);
});*/
this.storage.query("INSERT OR IGNORE INTO kv (key, value) VALUES " +
"('familias', '')," +
"('likes', '')," +
"('entity', '')," +
"('user', '')," +
"('tiposElementos', '')," +
"('tiposIncidencias', '')," +
"('estados', '')," +
"('responsables', '')," +
"('firstRun', '')," +
"('language', '');").then((data) => {
resolve(data);
}, (error) => {
//reject("ERROR -> " + error);
console.log(error);
});
});
开发者ID:GECOR,项目名称:gecor-generic-2016,代码行数:48,代码来源:db.ts
示例8:
storage.get('page').then((page) => {
if (page == 'signOut' || page == 'signIn') {
storage.set('page', 'shopping');
global.socket.emit('api', {
token: data.token,
module: 'system',
action: 'screen'
});
global.socket.emit('api', {
token: data.token,
module: 'member',
action: 'profile'
});
}
});
开发者ID:RemaxThailand,项目名称:RemaxMobile,代码行数:16,代码来源:app.ts
示例9: KEY
');').then((data) => {
this.storage.query('CREATE TABLE IF NOT EXISTS Base_atribute (' +
'_id INTEGER PRIMARY KEY AUTOINCREMENT,' +
'System_id INTEGER,' +
'name TEXT NULL,' +
'FOREIGN KEY(System_id) REFERENCES System(_id)' +
');').then((data) => {
this.storage.query('CREATE TABLE IF NOT EXISTS Secundary_atribute (idSecundary_atribute INTEGER PRIMARY KEY AUTOINCREMENT,name TEXT);')
.then((data) => {
this.storage.query('CREATE TABLE IF NOT EXISTS Characters_has_Skill (' +
'Characters_idCharacters INTEGER,' +
'Skill_idSkill INTEGER,' +
'level INTEGER UNSIGNED NULL,' +
'FOREIGN KEY(Characters_idCharacters) REFERENCES Characters(_id),' +
'FOREIGN KEY(Skill_idSkill) REFERENCES Skill(_id)' +
');').then((data) => {
this.storage.query('CREATE TABLE IF NOT EXISTS Characters_has_Secundary_atribute (' +
'Characters_idCharacters INTEGER,' +
'Secundary_atribute_idSecundary_atribute INTEGER,' +
'value INTEGER,' +
'FOREIGN KEY(Characters_idCharacters) REFERENCES Characters(_id),' +
'FOREIGN KEY(Secundary_atribute_idSecundary_atribute) REFERENCES Secundary_atribute(_id)' +
');').then((data) => {
this.storage.query('CREATE TABLE IF NOT EXISTS Characters_has_Base_atribute (' +
'Characters_idCharacters INTEGER,' +
'Base_atribute_idBase_atribute INTEGER,' +
'value INTEGER,' +
'FOREIGN KEY(Characters_idCharacters) REFERENCES Characters(_id),' +
'FOREIGN KEY(Base_atribute_idBase_atribute) REFERENCES Base_atribute(_id)' +
');').then((data) => {
console.log("DB OK");
}, (error) => {
console.log("Characters_has_Base_atribute ERROR -> " + JSON.stringify(error.err), error);
});
}, (error) => {
console.log("Characters_has_Secundary_atribute ERROR -> " + JSON.stringify(error.err), error);
});
}, (error) => {
console.log("Characters_has_Skill ERROR -> " + JSON.stringify(error.err), error);
});
}, (error) => {
console.log("Secundary_atribute ERROR -> " + JSON.stringify(error.err), error);
});
}, (error) => {
console.log("Base_atribute ERROR -> " + JSON.stringify(error.err), error);
});
}, (error) => {
开发者ID:DaniloCouto,项目名称:Ionic_2_RPG_Character_Database,代码行数:47,代码来源:sql-helper.ts
注:本文中的ionic-angular.Storage类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论