UNPKG

8.32 kBMarkdownView Raw
1
2- setup
3- component
4- loader
5- router
6- fetcher
7- batcher
8- path
9- global
10
11### Oxe.setup(options)
12The recommend entry or setup method.
13- `options: Object`
14 - `listener: Object`
15 - `before: Function`
16 - `after: Function`
17 - `path: Object` Oxe.path options
18 - `loader: Object` Oxe.loader options
19 - `router: Object` Oxe.router options
20 - `batcher: Object` Oxe.batcher options
21 - `fetcher: Object` Oxe.fetcher options
22
23### Oxe.path
24- `setup: AsyncFunction`
25 - `options: Object`
26 - `base: String` Sets or and creates a base tag
27
28### Oxe.component
29- `setup: AsyncFunction`
30 - `options: Object`
31 - `components: Array`
32 - `component: Object` A component definition.
33- `define: Function` Defines a custom web component.
34 - `options: Object`
35 - `name: String` **Required** the tag name
36 - `model: Object<Any>`
37 - `methods: Object<Function>`
38 - `template: String`
39 - `style: String` Rewrites CSS variables and :scope if browser support is lacking
40 - `shadow: Boolean` (default: false) use shadow DOM
41 - `properties: Object<Descriptors>` Property descriptors added to the element prototype
42 - `created: Function` Triggered once on DOM creation
43 - `attached: Function` Triggered on each DOM attachment
44 - `detached: Function` Triggered on each DOM detachment
45 - `attributed: Function` Triggered on each attribute change
46
47### Oxe.loader
48Loads files and dependencies asynchronously. ES6 import/export module and template string re-write support via transformers.
49
50**Caveats**
51- Supported import/export re-writes
52 - `import Name from './path'`
53 - `import './path'`
54 - `export default`
55- Commented and string or template string import/export might have issues
56- Template string re-writes may not handle nested backtick/template string correctly
57- Uses fetch or XHR and new Function until dynamic imports are supported.
58
59- `options: Object`
60 - `type: String`
61 - `es` Enables ES6 module and template string re-writes
62 - `est` Enables ES6 template string re-writes uses
63 - `esm` Enables ES6 module re-writes uses (Note: only supporting default export/import)
64 - `loads: Array` Adds load objects or strings such as non route components
65 - `load: Object, String`
66 - `url: String` **Required** Path to file resources
67 - `type: String` If not defined uses the default type
68- `setup: Function`
69 - `options: Object` Accepts the above options
70- `load: Function`
71 - `load: Object, String`
72 - `url: String` **Required** Path to file resources
73 - `type: String` If not defined uses the default type based from extension
74
75### Oxe.router
76- `options: Object`
77 - `folder: String` (default: '/routes') resolves the route is provided a string
78 - `mode: String` (default: push) The href option uses `window.location.assign`
79 - href
80 - push
81 - replace
82 - `element: String, Element` (default: 'o-router') The element to render route changes
83 - `contain: Boolean` (default: false) Limits all href clicks to the 'o-router' element
84 - `external: String, RegExp, Function` Filters URL requests. If true or match Oxe.router will not handle request
85 - `before: AsyncFunction` Invoked before the routed
86 - `location: Object` Oxe.router.location argument for the upcoming route
87 - `routes: Array`
88 - `route: Object, String, Component<Options>` Dynamically loads the string based on the Oxe.router.folder and appends .js
89 - `load: String` Dynamically loads the content and assigns it to the route object
90 - `path: String` Any path starting with forward slash
91 - `parameters: String` Paths can have parameters `/account/{user}` or catchalls `{\*}`
92 - `title: String` Sets the page title
93 - `keywords: String` Sets the page keywords
94 - `description: String` Sets the page description
95 - `handler: Function` Overrides the default render method
96 - `component: Object, String` An Oxe.component.define options object or a component name
97- `setup: AsyncFunction`
98 - `options: Object` Accepts the above options
99- `location: Object` Similar to window.location
100 <!-- - `base: String` Base href or origin -->
101 - `href: String`
102 - `host: String`
103 - `hash: String`
104 - `port: String`
105 - `title: String`
106 - `query: Object` Key value pairs of search/query
107 - `origin: String`
108 - `search: String`
109 <!-- - `basename: String` Base without the origin -->
110 - `hostname: String`
111 - `pathname: String` A pathname even when using hash urls
112 - `protocol: String`
113 <!-- - `username: String` -->
114 <!-- - `password: String` -->
115 - `parameters: Object` Key value pairs of the route dynamic route parameters
116- `render: Function` Will render a route object it is useful if your using route as a handler
117- `redirect: Function` Uses window.location.href which is treated like a 301 redirect for SEO
118 - `path: String`
119- `create: Function`
120 - `route: Object`
121- `add: Function`
122 - `path: String`
123- `remove: Function`
124 - `path: String`
125- `get: Function`
126 - `path: String` Strict path matching the route path parameters are not considered
127- `find: Function`
128 - `path: String` Loose path matching the route path parameters are considered
129- `filter: Function`
130 - `path: String, RegExp` Loose path matching the route path parameters are considered or a RegExp.
131- `route: AsyncFunction` Routes to the path
132 - `path: String` Path to navigate
133 - `options: Object`
134 - `replace: Boolean` (default: false) replace or push state
135 - `query: Object` Converts a key value pair to a query/search string and appends to the path
136- `on: EventEmitter`
137 - `routing`
138 - `routed`
139
140### Oxe.batcher
141Batches DOM reads and writes.
142- `options: Object`
143 - `time: Number` (default: 1000/60)
144- `setup: Function`
145 - `options: Object`
146- `tick: Function`
147- `flush: Function`
148- `schedule: Function`
149- `remove: Function`
150- `clear: Function`
151- `batch: Function`
152
153### Oxe.fetcher
154- `setup: Function`
155 - `options: Object` Accepts `window.fetch` options
156 - `path: String` The default path for the url options (requires origin)
157 - `origin: String` The default origin for url options
158 - `header: Object` (default: null) Http headers to be assigned to requests
159 - `acceptType: String` Valid http `Accept-Type` value or a Oxe.fetcher.mime name
160 - `contentType: String` Valid http `Content-Type` value or a Oxe.fetcher.mime name
161 - `responseType: String` (default: ReadableStream)
162 - `arrayBuffer`
163 - `document`
164 - `blob`
165 - `json`
166 - `text`
167 - `request: Function, AsyncFunction` Intercepts the request. If the return value is false the fetch will stop if the value is a object it will assign/overwrite the current request data.
168 - `data: Object` Argument to be sent as the request
169 - `response: Function, AsyncFunction` Intercepts the response. If the return value is false the fetch will stop if the value is a object it will assign/overwrite the current response data.
170 - `data: Object` Argument to be sent as the response
171- `fetch: AsyncFunction` Accepts `window.fetch` options
172 - `options: Object`
173 - `path: String` The path for the url options (requires origin)
174 - `origin: String` The origin for the url options
175 - `url: String` An absolute url or the combination of the origin and path
176 - `method: String` Required http method
177 - `body: Object` If method is GET than body is concatenated to the url as parameters
178 - `head: Object`
179 - `contentType: String` Overrides the setup contentType.
180 - `acceptType: String` Overrides the setup acceptType.
181 - `responseType: String` Overrides the setup responseType.
182- `get: AsyncFunction`
183 - `options: Object` Accepts `Oxe.fetcher.fetch` options
184- `put: AsyncFunction`
185 - `options: Object` Accepts `Oxe.fetcher.fetch` options
186- `post: AsyncFunction`
187 - `options: Object` Accepts `Oxe.fetcher.fetch` options
188- `head: AsyncFunction`
189 - `options: Object` Accepts `Oxe.fetcher.fetch` options
190- `delete: AsyncFunction`
191 - `options: Object` Accepts `Oxe.fetcher.fetch` options
192- `patch: AsyncFunction`
193 - `options: Object` Accepts `Oxe.fetcher.fetch` options
194- `options: AsyncFunction`
195 - `options: Object` Accepts `Oxe.fetcher.fetch` options
196- `connect: AsyncFunction`
197 - `options: Object` Accepts `Oxe.fetcher.fetch` options
198- `serialize: AsyncFunction`
199- `mime: Object`
200 - `xml` 'text/xml; charset=utf-8'
201 - `text` 'text/text; charset=utf-8'
202 - `html` 'text/html; charset=utf-8'
203 - `json` 'application/json; charset=utf-8'
204 - `js` 'application/javascript; charset=utf-8'
205
206### Oxe.global
207A global object for random data.