Skip to content

Commit 95bb660

Browse files
committed
Merge branch 'main' of github.com:djthorpe/js-framework into main
2 parents 905ad54 + 355b4f9 commit 95bb660

File tree

1 file changed

+2
-37
lines changed

1 file changed

+2
-37
lines changed

README.md

Lines changed: 2 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -37,46 +37,11 @@ Use the framework as follows:
3737
[bash] cd $PROJECTS
3838
[bash] git clone git@github.com:@owner/js-project.git
3939
[bash] cd js-project
40+
[bash] npm init
4041
[bash] echo "@djthorpe:registry=https://npm.pkg.github.com" >> .npmrc
4142
[bash] npm install @djthorpe/js-framework
4243
```
4344

4445
## Class Reference
4546

46-
### Provider
47-
48-
The provider is used to fetch JSON objects and arrays from a remote REST source, and stores them. To construct a provider with a model class called MyModelClass,
49-
50-
```javascript
51-
import Provider from '@djthorpe/js-framework';
52-
import MyModelClass from './models';
53-
54-
const origin = 'https://awesome-data-service.com/';
55-
const provider = new Provider(MyModelClass,origin);
56-
```
57-
58-
If the __Model__ class is not provided then a plain vanilla object
59-
is used. The origin is also optional.
60-
61-
You can create a request to a remote API using the `request` method, which will
62-
return immediately, whilst firing events,
63-
64-
```javascript
65-
const path = '/api/datasource';
66-
const req = { method: 'GET' };
67-
const userInfo = null;
68-
const interval = 30 * 1000; // Request every 30 seconds
69-
provider.request(path,req,userInfo,interval);
70-
```
71-
72-
The `req`, `userInfo` and `interval` arguments are optional. If you use
73-
an interval, a request is immediately made and then again periodically. To
74-
cancel an interval, call `provider.cancel();`.
75-
76-
The events fired are as followed:
77-
78-
`mvc.provider.added` (sender,object)
79-
`mvc.provider.changed` (sender,object,existing)
80-
`mvc.provider.deleted` (sender,object)
81-
`mvc.provider.completed` (sender,changed)
82-
`mvc.provider.error` (sender,Error)
47+
The class reference is included in the `dist` folder of the module, and uses `jsdoc` in order to create from the Javascript source.

0 commit comments

Comments
 (0)