sparkjs-will
TypeScript icon, indicating that this package has built-in type declarations

1.1.70 • Public • Published

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

Readme

Keywords

none

Package Sidebar

Install

npm i sparkjs-will

Weekly Downloads

2

Version

1.1.70

License

ISC

Unpacked Size

59.2 kB

Total Files

73

Last publish

Collaborators

  • will188