Commit d933ce0 1 parent aa7cd14 commit d933ce0 Copy full SHA for d933ce0
File tree 5 files changed +36
-31
lines changed
5 files changed +36
-31
lines changed Original file line number Diff line number Diff line change @@ -13,12 +13,12 @@ $ npm install @rapid-build-ui/rb-base
13
13
* The view rendering engine [ lit-html] ( https://polymer.github.io/lit-html/ ) .
14
14
* Imports:
15
15
* guid-service.js
16
+ * type-service.js
16
17
* view-directives.js
17
18
* Callbacks:
18
19
* viewReady()
19
20
* Creates this.rb object that contains a set of common helper objects:
20
21
* this.rb.events
21
- * this.rb.type
22
22
* this.rb.view
23
23
24
24
@@ -57,6 +57,7 @@ Executed once when view is ready and all its rb sub components views are ready.
57
57
Use when you need to make sure elements are accessible in the shadow dom.
58
58
59
59
60
+
60
61
## Imports (optional)
61
62
62
63
### guid-service.js
@@ -65,8 +66,30 @@ Use when you need to make sure elements are accessible in the shadow dom.
65
66
66
67
``` js
67
68
// Example
68
- import guid from ' ../../rb-base/scripts/guid-service.js' ;
69
- const id = guid .create ();
69
+ import Guid from ' ../../rb-base/scripts/guid-service.js' ;
70
+ const guid = Guid .create ();
71
+ ```
72
+
73
+
74
+ ### type-service.js
75
+ * Methods (** is.methods() : boolean ** )
76
+ * get(val) :string (returns val type)
77
+ * is.array(val)
78
+ * is.boolean(val)
79
+ * is.function(val)
80
+ * is.int(val)
81
+ * is.null(val)
82
+ * is.number(val)
83
+ * is.object(val)
84
+ * is.promise(val)
85
+ * is.string(val)
86
+ * is.stringArray(val)
87
+ * is.undefined(val)
88
+
89
+ ``` js
90
+ // Example
91
+ import Type from ' ../../rb-base/scripts/type-service.js' ;
92
+ const isString = Type .is .string (' rapid' );
70
93
```
71
94
72
95
@@ -99,22 +122,6 @@ to be used in view.
99
122
* emit(elm, 'event' [, { detail: any } ]) :boolean
100
123
101
124
102
- ### this.rb.type
103
- * Methods (** is.methods() : boolean ** )
104
- * get(val) :string (returns val type)
105
- * is.array(val)
106
- * is.boolean(val)
107
- * is.function(val)
108
- * is.int(val)
109
- * is.null(val)
110
- * is.number(val)
111
- * is.object(val)
112
- * is.promise(val)
113
- * is.string(val)
114
- * is.stringArray(val)
115
- * is.undefined(val)
116
-
117
-
118
125
### this.rb.view
119
126
* Properties
120
127
* isReady :boolean (readonly, will be true when view is ready)
Original file line number Diff line number Diff line change 12
12
- this.rb.events.emit(elm, 'event' [, { detail: any } ]); :boolean
13
13
********************************************************************************/
14
14
import { emit } from '../../../skatejs/dist/esnext/emit.js' ;
15
- import guid from './guid-service.js' ;
15
+ import Guid from './guid-service.js' ;
16
16
17
17
/* Event Helpers
18
18
****************/
@@ -24,7 +24,7 @@ const EventHelper = {
24
24
} ,
25
25
_getSpace ( target , space = null ) { // :string
26
26
if ( target . dataset . rbEvent ) return target . dataset . rbEvent ;
27
- if ( ! space ) space = guid . create ( 5 ) ;
27
+ if ( ! space ) space = Guid . create ( 5 ) ;
28
28
target . dataset . rbEvent = space ;
29
29
return space ;
30
30
} ,
@@ -99,7 +99,7 @@ const EventHelper = {
99
99
return EventHelper . getCallbackName . call ( this , callback . func ) ;
100
100
101
101
if ( ! callback . name ) // for anonymous functions (set name for removeAll())
102
- Object . defineProperty ( callback , 'name' , { value : guid . create ( 5 ) } ) ;
102
+ Object . defineProperty ( callback , 'name' , { value : Guid . create ( 5 ) } ) ;
103
103
104
104
// bound functions are prefixed with 'bound '
105
105
return callback . name . replace ( / ^ b o u n d / , '' ) ;
Original file line number Diff line number Diff line change 2
2
* GUID SERVICE
3
3
****************************************
4
4
* HOW TO USE
5
- - import guid from './guid-service.js';
5
+ - import Guid from './guid-service.js';
6
6
* API
7
- - guid .create(maxLength = 12); :string
7
+ - Guid .create(maxLength = 12); :string
8
8
****************************************/
9
9
const GuidService = {
10
10
create ( maxLength = 12 ) { // :string (sometimes returns maxLength - 1 chars)
Original file line number Diff line number Diff line change 4
4
import { props , withComponent } from '../../../skatejs/dist/esnext/index.js' ;
5
5
import { html , render } from '../../../lit-html/lit-html.js' ;
6
6
import EventService from './event-service.js' ;
7
- import TypeService from './type-service.js' ;
8
7
import ViewService from './view-service.js' ;
9
8
10
9
/* RB Base Class
@@ -16,7 +15,6 @@ const RbBase = (Base = HTMLElement) => class extends withComponent(Base) {
16
15
super ( ) ;
17
16
this . rb = {
18
17
events : EventService . call ( this ) ,
19
- type : TypeService ,
20
18
view : ViewService . call ( this )
21
19
}
22
20
}
Original file line number Diff line number Diff line change 1
- /***********************************************************
1
+ /****************************************
2
2
* TYPE SERVICE
3
- ***********************************************************
3
+ ****************************************
4
4
* HOW TO USE
5
- - import TypeService from './type-service.js';
6
- - this.rb.type = TypeService; :object (set in constructor)
7
- *********************************************************** /
5
+ - import Type from './type-service.js';
6
+ - Type = TypeService; :object
7
+ ****************************************/
8
8
const TypeService = {
9
9
/* Return Type as String
10
10
************************/
You can’t perform that action at this time.
0 commit comments