@momo-kits/foundation 0.75.1-beta.8 → 0.76.1-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (50) hide show
  1. package/{Navigation → Application}/BottomTab.tsx +19 -6
  2. package/{Navigation → Application}/Components.tsx +24 -15
  3. package/{Navigation → Application}/ModalScreen.tsx +17 -13
  4. package/{Navigation → Application}/Navigation.ts +5 -5
  5. package/{Navigation → Application}/NavigationContainer.tsx +3 -3
  6. package/{Navigation → Application}/StackScreen.tsx +7 -7
  7. package/{Navigation → Application}/index.ts +7 -3
  8. package/{Navigation → Application}/types.ts +23 -5
  9. package/{Navigation → Application}/utils.tsx +4 -6
  10. package/Assets/icon.json +6 -0
  11. package/Button/index.tsx +1 -1
  12. package/CheckBox/index.tsx +1 -1
  13. package/Consts/theme.ts +1 -1
  14. package/Divider/index.tsx +1 -1
  15. package/Icon/index.tsx +2 -2
  16. package/IconButton/index.tsx +1 -1
  17. package/Image/index.tsx +4 -2
  18. package/Input/Input.tsx +2 -1
  19. package/Input/InputMoney.tsx +2 -1
  20. package/Input/InputSearch.tsx +4 -2
  21. package/Input/InputTextArea.tsx +20 -19
  22. package/Input/common.tsx +1 -1
  23. package/Input/index.tsx +2 -0
  24. package/Layout/Card.tsx +108 -54
  25. package/Layout/GridSystem.tsx +4 -2
  26. package/Layout/Item.tsx +60 -0
  27. package/Layout/Screen.tsx +188 -0
  28. package/Layout/Section.tsx +12 -9
  29. package/Layout/index.ts +2 -1
  30. package/Layout/types.ts +7 -7
  31. package/Layout/utils.ts +46 -16
  32. package/Pagination/Dot.tsx +1 -1
  33. package/Pagination/PaginationDot.tsx +1 -1
  34. package/Pagination/PaginationNumber.tsx +1 -2
  35. package/Pagination/PaginationScroll.tsx +2 -1
  36. package/Pagination/PaginationWhiteDot.tsx +1 -1
  37. package/Popup/PopupNotify.tsx +1 -1
  38. package/Popup/PopupPromotion.tsx +1 -1
  39. package/Radio/index.tsx +1 -1
  40. package/Switch/index.tsx +1 -1
  41. package/Tag/index.tsx +3 -1
  42. package/Text/index.tsx +5 -4
  43. package/Text/utils.ts +14 -0
  44. package/index.ts +9 -2
  45. package/package.json +40 -40
  46. package/publish.sh +2 -5
  47. package/Layout/ScreenContainer.tsx +0 -122
  48. package/Navigation/Observer.ts +0 -79
  49. /package/{Navigation → Application}/NavigationButton.tsx +0 -0
  50. /package/{Navigation → Application}/Navigator.ts +0 -0
package/Layout/utils.ts CHANGED
@@ -1,10 +1,10 @@
1
- import {Alert} from 'react-native';
2
- import React, {ReactElement} from 'react';
1
+ import {Alert, Dimensions} from 'react-native';
2
+ import React, {useEffect, useState} from 'react';
3
3
 
4
4
  /**
5
5
  * validate children type
6
6
  * @param children
7
- * @param childrenType
7
+ * @param childrenTypes
8
8
  */
9
9
  const validateChildren = (
10
10
  children:
@@ -17,34 +17,64 @@ const validateChildren = (
17
17
  | null
18
18
  | undefined
19
19
  | boolean,
20
- childrenType: React.FC<any>,
20
+ childrenTypes: Array<React.FC<any>>,
21
21
  ) => {
22
22
  if (!__DEV__) return children;
23
+
23
24
  let results: React.ReactElement[] = [];
25
+ const validateType = (child: React.ReactElement) => {
26
+ return childrenTypes.some(childrenType => child?.type === childrenType);
27
+ };
28
+
29
+ const alertWrongType = () => {
30
+ Alert.alert(
31
+ 'Component Kits',
32
+ `Wrong children type for this component, expected are ${childrenTypes
33
+ .map(type => type.displayName)
34
+ .join(', ')}.`,
35
+ );
36
+ };
37
+
24
38
  if (Array.isArray(children)) {
25
- results = children?.filter((child: ReactElement) => {
26
- if (child?.type === childrenType) {
39
+ const flattenChildren = children.flat();
40
+ results = flattenChildren.filter((child: React.ReactElement) => {
41
+ if (validateType(child)) {
27
42
  return child;
28
43
  } else {
29
- Alert.alert(
30
- 'Component Kits',
31
- `Wrong children type for this component, expected is ${childrenType.displayName}.`,
32
- );
44
+ alertWrongType();
33
45
  }
34
46
  });
35
47
  } else {
36
48
  const singleChild: any = children;
37
- if (singleChild?.type === childrenType) {
49
+ if (validateType(singleChild)) {
38
50
  results = [singleChild];
39
51
  } else {
40
- Alert.alert(
41
- 'Component Kits',
42
- `Wrong children type for this component, expected is ${childrenType.displayName}.`,
43
- );
52
+ alertWrongType();
44
53
  }
45
54
  }
46
55
 
47
56
  return results;
48
57
  };
49
58
 
50
- export {validateChildren};
59
+ const useGridSystem = () => {
60
+ const [numberOfColumns, setNumberOfColumns] = useState(
61
+ Dimensions.get('window').width > 600 ? 24 : 12,
62
+ );
63
+
64
+ useEffect(() => {
65
+ const subscription: any = Dimensions.addEventListener(
66
+ 'change',
67
+ ({window}: any) => {
68
+ const newColumns = Dimensions.get('window').width > 600 ? 24 : 12;
69
+ if (newColumns != numberOfColumns) {
70
+ setNumberOfColumns(newColumns);
71
+ }
72
+ },
73
+ );
74
+ return () => subscription?.remove();
75
+ }, []);
76
+
77
+ return {numberOfColumns};
78
+ };
79
+
80
+ export {validateChildren, useGridSystem};
@@ -2,7 +2,7 @@ import React, {FC, useContext} from 'react';
2
2
  import {Animated} from 'react-native';
3
3
  import styles from './styles';
4
4
  import {DotProps} from './types';
5
- import {ApplicationContext} from '../Navigation';
5
+ import {ApplicationContext} from '../Application';
6
6
 
7
7
  const Dot: FC<DotProps> = ({active, style}) => {
8
8
  const {theme} = useContext(ApplicationContext);
@@ -4,7 +4,7 @@ import {ChildPaginationProps} from './types';
4
4
  import Dot from './Dot';
5
5
  import styles from './styles';
6
6
  import {Spacing} from '../Consts';
7
- import {ApplicationContext} from '../Navigation';
7
+ import {ApplicationContext} from '../Application';
8
8
 
9
9
  const PaginationDot: FC<ChildPaginationProps> = ({
10
10
  dataLength = 2,
@@ -3,14 +3,13 @@ import {View} from 'react-native';
3
3
  import {ChildPaginationProps} from './types';
4
4
  import styles from './styles';
5
5
  import {Text} from '../Text';
6
- import {ApplicationContext} from '../Navigation';
6
+ import {ApplicationContext} from '../Application';
7
7
  import {Colors} from '../Consts';
8
8
 
9
9
  const PaginationNumber: FC<ChildPaginationProps> = ({
10
10
  activeIndex = 0,
11
11
  dataLength = 2,
12
12
  }) => {
13
- const {theme} = useContext(ApplicationContext);
14
13
  return (
15
14
  <View style={[styles.paginationNumberContainer]}>
16
15
  <Text color={Colors.black_01} typography={'label_default'}>{`${
@@ -2,7 +2,7 @@ import React, {FC, useContext, useRef, useState} from 'react';
2
2
  import {Animated, View} from 'react-native';
3
3
  import {ScrollIndicatorProps} from './types';
4
4
  import styles from './styles';
5
- import {ApplicationContext} from '../Navigation';
5
+ import {ApplicationContext} from '../Application';
6
6
 
7
7
  const INDICATOR_WIDTH = 24;
8
8
  const INDICATOR_CONTAINER_WIDTH = 72;
@@ -31,6 +31,7 @@ const PaginationScroll: FC<ScrollIndicatorProps> = ({
31
31
  const renderScrollView = () => {
32
32
  return (
33
33
  <Animated.ScrollView
34
+ accessibilityLabel={'PaginationScroll'}
34
35
  ref={scrollViewRef}
35
36
  onScroll={Animated.event(
36
37
  [
@@ -4,7 +4,7 @@ import {ChildPaginationProps} from './types';
4
4
  import styles from './styles';
5
5
  import Dot from './Dot';
6
6
  import {Colors, Spacing} from '../Consts';
7
- import {ApplicationContext} from '../Navigation';
7
+ import {ApplicationContext} from '../Application';
8
8
 
9
9
  const PaginationWhiteDot: FC<ChildPaginationProps> = ({
10
10
  dataLength = 2,
@@ -4,7 +4,7 @@ import {PopupNotifyProps} from './types';
4
4
  import {Radius, Spacing, Styles} from '../Consts';
5
5
  import {Image} from '../Image';
6
6
  import {Text} from '../Text';
7
- import {ApplicationContext} from '../Navigation';
7
+ import {ApplicationContext} from '../Application';
8
8
  import {Button} from '../Button';
9
9
  import {Icon} from '../Icon';
10
10
 
@@ -1,7 +1,7 @@
1
1
  import React, {useContext} from 'react';
2
2
  import {StyleSheet, TouchableOpacity, View} from 'react-native';
3
3
  import {PopupPromotionProps} from './types';
4
- import {ApplicationContext} from '../Navigation';
4
+ import {ApplicationContext} from '../Application';
5
5
  import {Image} from '../Image';
6
6
  import {Radius, Spacing} from '../Consts';
7
7
  import {Icon} from '../Icon';
package/Radio/index.tsx CHANGED
@@ -4,7 +4,7 @@ import {TouchableOpacity, View} from 'react-native';
4
4
  import {RadioProps} from './types';
5
5
  import {Text} from '../Text';
6
6
  import styles from './styles';
7
- import {ApplicationContext} from '../Navigation';
7
+ import {ApplicationContext} from '../Application';
8
8
  import {Spacing} from '../Consts';
9
9
 
10
10
  const Radio: FC<RadioProps> = ({
package/Switch/index.tsx CHANGED
@@ -2,7 +2,7 @@ import React, {FC, useContext} from 'react';
2
2
  import {TouchableOpacity, View} from 'react-native';
3
3
  import {SwitchProps} from './types';
4
4
  import styles from './styles';
5
- import {ApplicationContext} from '../Navigation';
5
+ import {ApplicationContext} from '../Application';
6
6
  import {Colors} from '../Consts';
7
7
 
8
8
  const Switch: FC<SwitchProps> = props => {
package/Tag/index.tsx CHANGED
@@ -60,7 +60,9 @@ const Tag: FC<TagProps> = ({
60
60
  }
61
61
 
62
62
  return (
63
- <View style={[style, sizeStyle, {backgroundColor: tagColor}]}>
63
+ <View
64
+ style={[style, sizeStyle, {backgroundColor: tagColor}]}
65
+ accessibilityLabel={`Tag/${label}`}>
64
66
  {!!icon && (
65
67
  <Icon
66
68
  style={styles.icon}
package/Text/index.tsx CHANGED
@@ -2,8 +2,9 @@ import React, {useContext} from 'react';
2
2
  import {Text as RNText, TextProps as RNTextProps} from 'react-native';
3
3
  import styles from './styles';
4
4
  import {Typography, TypographyWeight} from './types';
5
- import {ApplicationContext} from '../Navigation';
5
+ import {ApplicationContext} from '../Application';
6
6
  import {GridContext} from '../Layout';
7
+ import {scaleSize} from './utils';
7
8
 
8
9
  const SFProText: TypographyWeight = {
9
10
  100: 'Thin',
@@ -93,8 +94,8 @@ const Text: React.FC<TextProps> = ({
93
94
 
94
95
  return {
95
96
  fontFamily,
96
- fontSize,
97
- lineHeight,
97
+ fontSize: scaleSize(fontSize),
98
+ lineHeight: scaleSize(lineHeight),
98
99
  fontStyle,
99
100
  };
100
101
  };
@@ -120,4 +121,4 @@ Text.defaultProps = {
120
121
  typography: 'paragraph_default',
121
122
  };
122
123
 
123
- export {Text};
124
+ export {Text, scaleSize};
package/Text/utils.ts ADDED
@@ -0,0 +1,14 @@
1
+ import {Dimensions} from 'react-native';
2
+
3
+ const deviceWidth = Dimensions.get('window').width;
4
+ const DEFAULT_SCREEN_SIZE = 375;
5
+ const scaleSize = (size: number) => {
6
+ const scaleRate = deviceWidth / DEFAULT_SCREEN_SIZE;
7
+
8
+ if (scaleRate > 1) {
9
+ return Math.min(Math.round(size * scaleRate), size + 5);
10
+ }
11
+
12
+ return size;
13
+ };
14
+ export {scaleSize};
package/index.ts CHANGED
@@ -5,8 +5,15 @@ import {
5
5
  } from 'react-native-safe-area-context';
6
6
  import LinearGradient from 'react-native-linear-gradient';
7
7
 
8
+ /**
9
+ * native export
10
+ */
8
11
  export {SafeAreaView, useSafeAreaInsets, SafeAreaProvider, LinearGradient};
9
12
 
13
+ /**
14
+ * foundation component
15
+ */
16
+
10
17
  export * from './Consts';
11
18
  export * from './Layout';
12
19
  export * from './Layout/types';
@@ -15,8 +22,8 @@ export * from './Popup/types';
15
22
  export * from './Text';
16
23
  export * from './Text/types';
17
24
  export * from './Button';
18
- export * from './Navigation';
19
- export * from './Navigation/types';
25
+ export * from './Application';
26
+ export * from './Application/types';
20
27
  export * from './Icon';
21
28
  export * from './Icon/types';
22
29
  export * from './IconButton';
package/package.json CHANGED
@@ -1,41 +1,41 @@
1
1
  {
2
- "name": "@momo-kits/foundation",
3
- "version": "0.75.1-beta.8",
4
- "description": "React Native Component Kits",
5
- "main": "index.ts",
6
- "scripts": {
7
- "test": "echo \"Error: no test specified\" && exit 1"
8
- },
9
- "keywords": [
10
- "@momo-kits/foundation"
11
- ],
12
- "dependencies": {
13
- "react-native-safe-area-context": "3.1.4",
14
- "react-native-linear-gradient": "2.5.6",
15
- "@react-navigation/bottom-tabs": "git+https://gitlab.com/dung.huynh1/react-navigation-bottom-tabs.git#main",
16
- "@react-navigation/core": "5.16.1",
17
- "@react-navigation/native": "5.9.8",
18
- "@react-navigation/routers": "5.7.4",
19
- "@react-navigation/stack": "git+https://gitlab.com/dung.huynh1/react-navigation-stack.git#main",
20
- "@gorhom/bottom-sheet": "2.4.1"
21
- },
22
- "peerDependencies": {
23
- "react-native": "*"
24
- },
25
- "devDependencies": {
26
- "@babel/core": "^7.12.9",
27
- "@babel/runtime": "^7.12.5",
28
- "@react-native-community/eslint-config": "^2.0.0",
29
- "@types/jest": "26.0.23",
30
- "@types/react-native": "0.64.4",
31
- "@types/react-test-renderer": "16.9.2",
32
- "babel-jest": "^26.6.3",
33
- "eslint": "^7.14.0",
34
- "jest": "^26.6.3",
35
- "metro-react-native-babel-preset": "^0.64.0",
36
- "react-test-renderer": "17.0.1",
37
- "typescript": "^4.0.3"
38
- },
39
- "author": "@momo-kits/foundation",
40
- "license": "ISC"
41
- }
2
+ "name": "@momo-kits/foundation",
3
+ "version": "0.76.1-beta.1",
4
+ "description": "React Native Component Kits",
5
+ "main": "index.ts",
6
+ "scripts": {
7
+ "test": "echo \"Error: no test specified\" && exit 1"
8
+ },
9
+ "keywords": [
10
+ "@momo-kits/foundation"
11
+ ],
12
+ "dependencies": {
13
+ "react-native-safe-area-context": "3.1.4",
14
+ "react-native-linear-gradient": "2.5.6",
15
+ "@react-navigation/bottom-tabs": "git+https://gitlab.com/dung.huynh1/react-navigation-bottom-tabs.git#main",
16
+ "@react-navigation/core": "5.16.1",
17
+ "@react-navigation/native": "5.9.8",
18
+ "@react-navigation/routers": "5.7.4",
19
+ "@react-navigation/stack": "git+https://gitlab.com/dung.huynh1/react-navigation-stack.git#main",
20
+ "@gorhom/bottom-sheet": "2.4.1"
21
+ },
22
+ "peerDependencies": {
23
+ "react-native": "*"
24
+ },
25
+ "devDependencies": {
26
+ "@babel/core": "^7.12.9",
27
+ "@babel/runtime": "^7.12.5",
28
+ "@react-native-community/eslint-config": "^2.0.0",
29
+ "@types/jest": "26.0.23",
30
+ "@types/react-native": "0.64.4",
31
+ "@types/react-test-renderer": "16.9.2",
32
+ "babel-jest": "^26.6.3",
33
+ "eslint": "^7.14.0",
34
+ "jest": "^26.6.3",
35
+ "metro-react-native-babel-preset": "^0.64.0",
36
+ "react-test-renderer": "17.0.1",
37
+ "typescript": "^4.0.3"
38
+ },
39
+ "author": "@momo-kits/foundation",
40
+ "license": "ISC"
41
+ }
package/publish.sh CHANGED
@@ -12,15 +12,12 @@ echo VERSION: $VERSION
12
12
 
13
13
  rsync -r --verbose --exclude '*.mdx' --exclude '*Demo.js' --exclude 'props-type.js' --exclude 'prop-types.js' ./* dist
14
14
 
15
- #babel component to dist
16
- #babel ./dist -d dist --copy-files
17
-
18
15
  cd dist
19
- npm publish --tag beta --access=public
16
+ npm publish --tag latest --access=public
20
17
 
21
18
  #clear dist and package json
22
19
  cd ..
23
20
  rm -rf dist
24
21
 
25
22
 
26
- #curl -X POST -H 'Content-Type: application/json' 'https://chat.googleapis.com/v1/spaces/AAAAbP8987c/messages?key=AIzaSyDdI0hCZtE6vySjMm-WEfRq3CPzqKqqsHI&token=UGSFRvk_oYb9uGsAgs31bVvMm6jDkmD8zihGm3eyaQA%3D&threadKey=JoaXTEYaNNkl' -d '{"text": "@momo-kits/core new version release: '*"$VERSION"*' https://www.npmjs.com/package/@momo-kits/core"}'
23
+ #curl -X POST -H 'Content-Type: application/json' 'https://chat.googleapis.com/v1/spaces/AAAAbP8987c/messages?key=AIzaSyDdI0hCZtE6vySjMm-WEfRq3CPzqKqqsHI&token=UGSFRvk_oYb9uGsAgs31bVvMm6jDkmD8zihGm3eyaQA%3D&threadKey=JoaXTEYaNNkl' -d '{"text": "@momo-kits/core new version release: '*"$VERSION"*' https://www.npmjs.com/package/@momo-kits/foundation"}'
@@ -1,122 +0,0 @@
1
- import {Animated, KeyboardAvoidingView, Platform, View} from 'react-native';
2
- import {useHeaderHeight} from '@react-navigation/stack';
3
- import {useSafeAreaInsets} from 'react-native-safe-area-context';
4
- import React, {useContext} from 'react';
5
- import {ScreenContainerProps} from '../Navigation/types';
6
- import {Spacing, Styles} from '../Consts';
7
- import {Section, validateChildren} from './index';
8
-
9
- import {ApplicationContext} from '../Navigation';
10
-
11
- const ScreenContainer: React.FC<ScreenContainerProps> = ({
12
- children,
13
- enableKeyboardAvoidingView,
14
- scrollable,
15
- scrollY,
16
- headerBackground,
17
- scrollViewProps,
18
- footerComponent: Footer,
19
- }) => {
20
- const {theme} = useContext(ApplicationContext);
21
- const insets = useSafeAreaInsets();
22
- let marginHeader = 0;
23
- let handleScroll;
24
- let imageAnimatedStyle = {};
25
- let Component: any = View;
26
- if (scrollable) {
27
- Component = Animated.ScrollView;
28
- }
29
- if (scrollY) {
30
- marginHeader = useHeaderHeight();
31
- imageAnimatedStyle = {
32
- transform: [
33
- {
34
- scale: scrollY.interpolate?.({
35
- inputRange: [-300, 0, 1],
36
- outputRange: [1.75, 1, 1],
37
- extrapolate: 'clamp',
38
- }),
39
- },
40
- ],
41
- };
42
- handleScroll = Animated.event(
43
- [{nativeEvent: {contentOffset: {y: scrollY}}}],
44
- {useNativeDriver: true},
45
- );
46
- }
47
-
48
- /**
49
- * build content for screen
50
- */
51
- const renderContent = () => {
52
- const results = validateChildren(children, Section);
53
- if (Array.isArray(results)) {
54
- return results.map((item, index) => {
55
- return (
56
- <View
57
- key={`Section${index}`}
58
- style={{
59
- marginTop: item.props?.useMargin ? Spacing.M : 0,
60
- flex: item.props?.expanded ? 1 : undefined,
61
- }}>
62
- {item}
63
- </View>
64
- );
65
- });
66
- }
67
- return results;
68
- };
69
-
70
- return (
71
- <View style={Styles.flex} accessibilityLabel={`ScreenContainer`}>
72
- <View
73
- style={{
74
- position: 'absolute',
75
- height: 300,
76
- width: '100%',
77
- }}>
78
- {!!headerBackground && (
79
- <Animated.Image
80
- source={{
81
- uri: headerBackground,
82
- }}
83
- style={{
84
- aspectRatio: 1.3,
85
- ...imageAnimatedStyle,
86
- }}
87
- />
88
- )}
89
- </View>
90
- <KeyboardAvoidingView
91
- style={Styles.flex}
92
- enabled={enableKeyboardAvoidingView}
93
- behavior={Platform.select({
94
- ios: 'padding',
95
- android: undefined,
96
- })}>
97
- <Component
98
- {...scrollViewProps}
99
- onScroll={handleScroll}
100
- style={[Styles.flex, {marginTop: marginHeader}]}>
101
- {renderContent()}
102
- </Component>
103
- {Footer && (
104
- <View
105
- style={{
106
- paddingTop: Spacing.S,
107
- paddingBottom: insets.bottom,
108
- backgroundColor: theme.colors.background.surface,
109
- }}>
110
- <Section>{Footer}</Section>
111
- </View>
112
- )}
113
- </KeyboardAvoidingView>
114
- </View>
115
- );
116
- };
117
-
118
- ScreenContainer.defaultProps = {
119
- enableKeyboardAvoidingView: false,
120
- scrollable: false,
121
- };
122
- export default ScreenContainer;
@@ -1,79 +0,0 @@
1
- class Subject {
2
- private observers: any[];
3
- constructor() {
4
- this.observers = [];
5
- }
6
-
7
- attach(observer: any) {
8
- observer && this.observers.push(observer);
9
- }
10
-
11
- detach(observer: any) {
12
- this.observers = this.observers.filter(item => item !== observer);
13
- }
14
-
15
- notify(newState: any) {
16
- this.observers.forEach(observer => {
17
- if (typeof observer === 'function') {
18
- observer(newState);
19
- } else {
20
- observer.updateData && observer.updateData(newState);
21
- }
22
- });
23
- }
24
- }
25
-
26
- class ObserverInstance {
27
- private readonly props: any;
28
- constructor(props: any) {
29
- this.props = props;
30
- }
31
-
32
- remove() {
33
- const {detach, observer} = this.props;
34
- detach && detach(observer);
35
- }
36
- }
37
-
38
- export default class Observer {
39
- static SCHEMA = 'Observer';
40
-
41
- static instances: any = {};
42
- private schema: any;
43
- private subject: Subject;
44
- private data: null;
45
- private loaded: boolean;
46
-
47
- constructor(props: any) {
48
- this.schema = props.schema;
49
- this.subject = new Subject();
50
- this.data = null;
51
- this.loaded = false;
52
- this.initilize();
53
- }
54
-
55
- static getInstance(schema: string, Class = Observer) {
56
- schema = schema || Class.SCHEMA;
57
- let instance = Observer.instances[schema];
58
- if (!instance) {
59
- instance = new Class({schema});
60
- Observer.instances[schema] = instance;
61
- }
62
- return instance;
63
- }
64
-
65
- initilize = () => {};
66
-
67
- notify = (state: any) => {
68
- this.subject.notify(state);
69
- };
70
-
71
- attach = (observer: any) => {
72
- this.subject.attach(observer);
73
- return new ObserverInstance({observer, detach: this.detach});
74
- };
75
-
76
- detach = (observer: any) => {
77
- this.subject.detach(observer);
78
- };
79
- }
File without changes