Skip to content

Commit

Permalink
Move required docs up
Browse files Browse the repository at this point in the history
  • Loading branch information
kriszyp committed Dec 2, 2010
1 parent eccbc47 commit 05a5ad6
Showing 1 changed file with 13 additions and 13 deletions.
26 changes: 13 additions & 13 deletions README.md
Expand Up @@ -137,6 +137,19 @@ object or else it will remain in a conflicted state. This essentially means that
provides straightforward, easy to use, method overriding, and ambiguous magical conflict
resolution (C3MRO).

We can specify required methods that must be overriden as well. For example, we can
define the Widget to require a generateHTML method:
<pre>
var required = Compose.required;
Widget = Compose({
generateHTML: required,
...
});
</pre>

And now to extend the Widget constructor, we must provide a generateHTML method.
Failure to do so will result in an error being thrown when generateHTML is called.

## Apply to an existing object

Compose can also be applied to existing objects to add/mixin functionality to that object.
Expand Down Expand Up @@ -256,19 +269,6 @@ call the base function:
});
</pre>

We can specify required methods that must be overriden as well. For example, we can
define the Widget to require a generateHTML method:
<pre>
var required = Compose.required;
Widget = Compose({
generateHTML: required,
...
});
</pre>

And now to extend the Widget constructor, we must provide a generateHTML method.
Failure to do so will result in an error being thrown when generateHTML is called.

### Non-enumerated methods

The dontEnum decorator can be used for non-enumerated methods:
Expand Down

0 comments on commit 05a5ad6

Please sign in to comment.