将设置值输入小工具页面 [英] Feed the settings values into the gadget page

查看:98
本文介绍了将设置值输入小工具页面的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发一个小工具.在设置html页面中设置值后,单击确定按钮后,设置页面值不会反映在小工具页面中.我正在使用setTimeout()方法刷新页面.但是我需要在关闭设置页面后立即应用设置值.我该怎么办?

预先感谢.

解决方案

附加到System.Gadget.Settings.write* 方法,您可以使用System.Gadget.Settings.readString()读回它们.或者,如果您钩上 解决方案

Attach to the System.Gadget.onSettingsClosed event in your main gadget page, and do your reloading there.  If you saved your settings using the System.Gadget.Settings.write* methods, you can read them back with System.Gadget.Settings.readString().  Alternatively, if you hook System.Gadget.onSettingsClosing in your settings page, you can write the values back into your main gadget document using System.Gadget.document.parentWindow.variableName and then reference those variables within the onSettingsClosed handler.  Obviously you'll need to handle the case when the settings dialog was closed by cancelling rather than submitting, but that info is easily available through the event object passed to the events.


这篇关于将设置值输入小工具页面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆