1.2.0 • Published 2 years ago

@schema-plugin-flow/sifo-singleton v1.2.0

Weekly downloads
3
License
MIT
Repository
github
Last release
2 years ago

sifo-singleton

这是一个全局单例容器,用于注册插件与组件,以命名空间区分。

SifoSingleton 类

SifoSingleton实例化参数

参数说明类型是否必传默认值
namespace命名空间,插件与组件通过同一命名空间读取string-

方法

方法名参数/类型返回值类型描述
registerItem(id: string, item: function)-注册对象
getRegisteredItems()array获取所有的命名空间下的注册对象

代码示例-注册

import SifoSingleton from '@schema-plugin-flow/sifo-singleton';
const singleton = new SifoSingleton('test');
singleton.registerItem('extendId01', (params) => {
  return {
    version: '1.0.0',
    plugins: [
      {
        componentPlugin: singleton_comp_plg,
        pagePlugin: {}
      }, 
      {
        pagePlugin: {
          onPageInitial: params => {
            console.log('singleton1 page plugin')
          }
        }
      }
    ],
    components: {
      test: TestComp
    }
  }
});

代码示例-取出

import SifoSingleton from '@schema-plugin-flow/sifo-singleton';
const singleton = new SifoSingleton('test');
const singletonItems = singleton.getRegisteredItems({ param1: 'testssss' });
singletonItems.forEach(registerItem => {
    const { components = {}, plugins = [] } = registerItem;
});
1.2.0

2 years ago

1.1.4

3 years ago

1.1.3

3 years ago

1.1.2

3 years ago

1.1.1

3 years ago

1.1.0

3 years ago

1.0.4

4 years ago

1.0.2

4 years ago

1.0.3

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago