Skip to content

Commit

Permalink
Merge pull request #22 from nippur72/no-register
Browse files Browse the repository at this point in the history
Removed the need for tag "registration"
  • Loading branch information
nippur72 committed Dec 10, 2015
2 parents f431f45 + b84082a commit b2ff973
Show file tree
Hide file tree
Showing 16 changed files with 14 additions and 85 deletions.
24 changes: 2 additions & 22 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ Use Muut's [Riot.js](https://muut.com/riotjs/) minimalistic framework from TypeS
- [How to write elements](#howtowrite)
- [How to correctly reference in markup](#howtoreference)
- [The @template decorator](#template)
- [Element registration](#register)
- [Lifecycle events shortcuts](#lifecycle)
- [How to create elements programmatically](#creating)
- [Observables](#observables)
Expand Down Expand Up @@ -48,7 +47,6 @@ In brief:
- Write elements as TypeScript classes
- Extend the `Riot.Element` class
- Use `@template` to define the template string or load it from URL
- register each element in riot via `className.register()` or register them all at once with `Riot.registerAll()`
- create instances of the element programmatically with `className.createElement()`.

A class-element:
Expand Down Expand Up @@ -85,9 +83,6 @@ class MyElement extends Riot.Element
{
// ...
}

// after the element is defined, we register it in Riot
MyElement.register();
```

In `elements/my-element.html`:
Expand Down Expand Up @@ -145,21 +140,6 @@ class MyHello extends Riot.Element
```
External tag files are loaded via HTTP requests, which can slow down the startup of very large applications. To avoid this, tags can be precompiled and concatenated into a single javascript file to be loaded more quickly. See how to setup [a grunt task that does this](#precompiled).

# Element registration <a name="register"></a>

Once the class Element has been defined, it needs to be registered in `riot`
by calling `ElemenClass.register()`.

Alternatively, elements can be registered all at once by calling
`Riot.registerAll()`, for example:

```TypeScript
window.onload = function()
{
Riot.registerAll();
riot.mount('*');
}
```

# Lifecycle events shortcuts <a name="lifecycle"></a>

Expand Down Expand Up @@ -293,8 +273,6 @@ class Timer extends Riot.Element {
Then install the element and mount on the page with:

```TypeScript
Timer.register();

riot.mount('*'); // mounts all elements
```

Expand Down Expand Up @@ -382,6 +360,8 @@ Contributions are welcome.
If you find bugs or want to improve it, just send a pull request.

# Change log <a name="changelog"></a>
- v0.0.22
- removed the need for registration, `.register` and `.registerAll` are now removed from the API
- v0.0.21
- aligned router API to riot v2.3.11
- v0.0.19
Expand Down
2 changes: 1 addition & 1 deletion Test/Test.csproj.user
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<VisualStudio>
<FlavorProperties GUID="{349c5851-65df-11da-9384-00065b846f21}">
<WebProjectProperties>
<StartPageUrl>index.html</StartPageUrl>
<StartPageUrl>specRunner.html</StartPageUrl>
<StartAction>SpecificPage</StartAction>
<AspNetDebugging>True</AspNetDebugging>
<SilverlightDebugging>False</SilverlightDebugging>
Expand Down
7 changes: 0 additions & 7 deletions Test/elements/specElements.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Test/elements/specElements.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 0 additions & 5 deletions Test/elements/specElements.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,6 @@ class test_template_from_url extends Riot.Element
}


class testNoTemplate extends Riot.Element
{

}

@template("<test-no-tag><span></span></test-no-tag>")
class testNoTagName extends Riot.Element
{
Expand Down
1 change: 0 additions & 1 deletion Test/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Test/index.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions Test/index.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
/// <reference path="bower_components/riot-ts/riot-ts.d.ts" />

function main()
{
Riot.registerAll();
{
riot.mount('*');
}

Expand Down
2 changes: 2 additions & 0 deletions Test/precompiled-tags.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 0 additions & 6 deletions Test/specRunner.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit b2ff973

Please sign in to comment.