Javascript 在共享首选项中存储变量值
我是Tianium和iPhone开发的新手,我想知道如何在共享优先权中存储变量的值,并在另一个js上获取该值?应用程序属性模块用于在应用程序会话和设备电源周期之外持续存在的属性/值对中存储应用程序相关数据 例子Javascript 在共享首选项中存储变量值,javascript,iphone,titanium,titanium-mobile,Javascript,Iphone,Titanium,Titanium Mobile,我是Tianium和iPhone开发的新手,我想知道如何在共享优先权中存储变量的值,并在另一个js上获取该值?应用程序属性模块用于在应用程序会话和设备电源周期之外持续存在的属性/值对中存储应用程序相关数据 例子 Store a property Store a string property. Ti.App.Properties.setString('givenName', 'Paul'); Ti.API.info('The value of the givenName property is
Store a property
Store a string property.
Ti.App.Properties.setString('givenName', 'Paul');
Ti.API.info('The value of the givenName property is: ' + Ti.App.Properties.getString('givenName'));
应用程序属性模块用于将应用程序相关数据存储在属性/值对中,这些属性/值对在应用程序会话和设备电源循环之后仍然存在 例子
Store a property
Store a string property.
Ti.App.Properties.setString('givenName', 'Paul');
Ti.API.info('The value of the givenName property is: ' + Ti.App.Properties.getString('givenName'));
演示钛合金应用程序属性模块使用的简单示例 我正在为service.js中运行的
service\u设置一个布尔值,并在app.js中进行验证
app.js
var isRunning = Ti.App.Properties.getBool("service_running", false);
if (isRunning)
Ti.API.info('service is running');
else
Ti.API.info('service is not running');
Ti.App.Properties.setBool("service_running", true);
在service.js中
var isRunning = Ti.App.Properties.getBool("service_running", false);
if (isRunning)
Ti.API.info('service is running');
else
Ti.API.info('service is not running');
Ti.App.Properties.setBool("service_running", true);
演示使用钛合金应用程序属性模块的简单示例
我正在为service.js中运行的service\u设置一个布尔值,并在app.js中进行验证
app.js
var isRunning = Ti.App.Properties.getBool("service_running", false);
if (isRunning)
Ti.API.info('service is running');
else
Ti.API.info('service is not running');
Ti.App.Properties.setBool("service_running", true);
在service.js中
var isRunning = Ti.App.Properties.getBool("service_running", false);
if (isRunning)
Ti.API.info('service is running');
else
Ti.API.info('service is not running');
Ti.App.Properties.setBool("service_running", true);