npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@tlbs/galaxy-sdk

v1.0.3

Published

galaxy data jssdk

Downloads

8

Readme

galaxy-sdk

概述

星河平台sdk,在星河代码编辑器可以直接使用提供的平台方法,如数据源、路由方法等。

路由

Tips:请注意,在代码编辑器中使用该路由函数时,不生效,需要预览或发布才有效果。

navigateTo(object)

保留当前页面,跳转到应用内的某个页面。

参数属性

| 参数 | 说明 | 类型 | 默认值 | 必填 | |---------- |-------- |---------- |------------- |-------- | | pageId | 页面 id | string | '' | 是 | | params | query object 对象 | object | {} | 否 |

示例代码

import {navigateTo} from '@tlbs/galaxy-sdk';
navigateTo({
  pageId: "index", // 页面 Id
  params: { key: "value" }
});

redirectTo(object)

关闭当前页面,跳转到应用内的某个页面。

参数属性

| 参数 | 说明 | 类型 | 默认值 | 必填 | |---------- |-------- |---------- |------------- |-------- | | pageId | 页面 id | string | '' | 是 | | params | query object 对象 | object | {} | 否 |

示例代码

import {redirectTo} from '@tlbs/galaxy-sdk';
redirectTo({
  pageId: "index", // 页面 Id
  params: { key: "value" }
});

navigateBack(object)

关闭当前页面,返回上一页面或多级页面。

参数属性

| 参数 | 说明 | 类型 | 默认值 | 必填 | |---------- |-------- |---------- |------------- |-------- | | delta | 返回的页面数,如果 delta 大于现有页面数,则返回到首页 | number | 1 | 否 |

示例代码

import {navigateBack} from '@tlbs/galaxy-sdk';
navigateBack();

getQueryParams(url)

获取url的query object 对象。

参数

| 参数 | 说明 | 类型 | 默认值 | 必填 | |---------- |-------- |---------- |------------- |-------- | | url | 页面url | string | '' | 是 |

示例代码

import {getQueryParams} from '@tlbs/galaxy-sdk';
getQueryParams('https://lbs.qq.com?a=1');

数据源

数据模型

$app.dataSource.callModel(Object)

调用数据源-数据模型的方法,异步 promise 形式,返回数据结果;建议用async/await 或 then 的方式调用。

入参属性

| 属性 | 类型 | 默认值 | 必填 | 说明 | |------------| ------ | ------ | ---- |-----------| | name | String | - | 是 | 数据模型的标识 | | methodName | String | - | 是 | 数据模型的方法标识 | | params | Object | - | 否 | 数据源模型方法参数 |

  // 备注,await方法外部函数需要使用async 修饰符
  const result = await $app.dataSource.callModel({
    name: 'table_NfHK5a84',
    methodName: 'xhSearch',
    params: {
      data_id: 'disBvEApAFve'
    }, //方法入参
  })
// result 为数据源方法云函数返回值