Skip to content

Commit

Permalink
Merge branch 'master' into add-typescript
Browse files Browse the repository at this point in the history
  • Loading branch information
lozjackson committed May 6, 2024
2 parents 9c0482d + 8b6ef54 commit 3977ab0
Showing 1 changed file with 9 additions and 17 deletions.
26 changes: 9 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,36 +32,28 @@ http://lozjackson.github.io/ember-clock/

## ClockService

The clock service is injected into all controllers and components.
The clock service should be injected into controllers and components where required.

To use the clock in a template or in computed properties, bind to the clock's
`hour`, `minute`, or `second` properties.

In templates:

```hbs
{{clock.hour}}
{{clock.minute}}
{{clock.second}}
{{this.clock.hour}}
{{this.clock.minute}}
{{this.clock.second}}
```

In computed properties:

```js
property: Ember.computed("clock.second", function () {
// this will update every second
});
```
@service clock;

```js
property: Ember.computed("clock.minute", function () {
// this will update every minute
});
```

```js
property: Ember.computed("clock.hour", function () {
// this will update every hour
get seconds() {
// this will update every second
const second = this.clock.second
return `${ second } seconds`
});
```

Expand Down

0 comments on commit 3977ab0

Please sign in to comment.