sparkjs-will
v1.1.72
Published
### Web platform To preview or test on web platform, it provides a `notify event` development way to simulate some native interactions. ``` enum MockWebEvent { AppThemeChange = 'app-theme-change', AppLanguageChange = 'app-language-change', App
Downloads
19
Readme
sparkjs
Web platform
To preview or test on web platform, it provides a notify event
development way to simulate some native interactions.
enum MockWebEvent {
AppThemeChange = 'app-theme-change',
AppLanguageChange = 'app-language-change',
AppConfigInit = 'app-config-init',
AppParametersInit = 'app-parameters-init',
}
The above helper instance is SparkDev
, and there are samples here:
// init app config
// ...
useEffect(() => {
(window as any).SparkDev?.notify("app-config-init", {
map: {
itemId: "web map id"
}
});
}, []);
const onHandleClick = async() => {
const res = await Spark.getAppConfig()
setResult(res.json)
}
// ...
// language change
// ...
useEffect(() => {
Spark.watchI18NChange((option: I18NOption | null, error) => {
setTranslateLabel(i18nStrings[option?.i18n || "en-US"]);
});
}, []);
const onHandleClick = async() => {
enLanguageRef.current = !enLanguageRef.current;
(window as any).SparkDev?.notify("app-language-change", {
i18n: enLanguageRef.current ? "en-US" : "zh-CN"
});
};
// ...
# username:will188, password:--
npm login
npm publish