Skip to content

Commit

Permalink
UI -> SMVC
Browse files Browse the repository at this point in the history
  • Loading branch information
lazamar committed Apr 21, 2024
1 parent 9f9efce commit 648686c
Show file tree
Hide file tree
Showing 7 changed files with 12 additions and 12 deletions.
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ A complete example. See it in action [here](https://lazamar.github.io/smvc/demos
<div id="container"></div>
<script src="./smvc.js"></script>
<script>
const { init, h, text } = UI;
const { init, h, text } = SMVC;
const root = document.querySelector("#container");
const initialState = 0;
Expand All @@ -41,15 +41,15 @@ A complete example. See it in action [here](https://lazamar.github.io/smvc/demos

## Quickstart

After importing `smvc.js` start your application by calling `UI.init` with the appropriate arguments.
After importing `smvc.js` start your application by calling `smvc.init` with the appropriate arguments.

You can use the library as follows:

```javascript
// `UI` is the only identifier the library adds to the global
// `SMVC` is the only identifier the library adds to the global
// scope. It is an object with a function to start the
// application and two functions to build html elements
const { init, h, text } = UI;
const { init, h, text } = SMVC;

// Where the application will be rendered
const root = document.querySelector("#container");
Expand All @@ -61,7 +61,7 @@ const initialState = { ... };
function update(state, msg, enqueue) { ... }

// A function to build the view using the `h` and `text`
// functions from in the UI object.
// functions from in the SMVC object.
function view(state) { ... }

// Start the application. `init` returns an object with the
Expand Down
2 changes: 1 addition & 1 deletion demos/million.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<html lang="en">
<head>
<meta charset="utf-8">
<title>Html-UI • Million</title>
<title>smvc • Million</title>
<style>
body {
height: 100vh;
Expand Down
2 changes: 1 addition & 1 deletion demos/million.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const { init, h, text } = UI;
const { init, h, text } = SMVC;

const colours = Array.from({ length: 200 }).map(_ => {
const r = Math.ceil(Math.random() * 255);
Expand Down
2 changes: 1 addition & 1 deletion demos/minimal.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<div id="container"></div>
<script src="../smvc.js"></script>
<script>
const { init, h, text } = UI;
const { init, h, text } = SMVC;
const root = document.querySelector("#container");
const initialState = 0;

Expand Down
2 changes: 1 addition & 1 deletion demos/todoMVC.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<html lang="en">
<head>
<meta charset="utf-8">
<title>Html-UI • TodoMVC</title>
<title>smvc • TodoMVC</title>
<link rel="stylesheet" href="todoMVC.css">
</head>
<body>
Expand Down
2 changes: 1 addition & 1 deletion demos/todoMVC.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const { init, h, text } = UI;
const { init, h, text } = SMVC;

const emit = v => _ => v;

Expand Down
4 changes: 2 additions & 2 deletions smvc.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
// , children : [ElementDiff]
// }
//
const UI = (function () {
const SMVC = (function () {

function assert(predicate, ...args) {
if (!predicate) {
Expand Down Expand Up @@ -281,5 +281,5 @@ return { init, h, text };
})();

if (typeof module !== 'undefined' && module.exports) {
module.exports = UI
module.exports = SMVC
}

0 comments on commit 648686c

Please sign in to comment.