Skip to content

Migrating to version 1.0.0 from 0.x

Jim Myrah edited this page Jul 22, 2015 · 2 revisions

Several breaking changes were introduced upon the release of 1.0.0. These changes were made to improve the comprehension of the API and make it more concise, and also to ensure the ng-idle module follows the best practices recommended by AngularJS.

The changes are categorized as follows.

Renamed Services

The $ prefix to services were removed, as this practice is considered reserved for AngularJS services. The list below details the original name of the ng-idle service in v0.x on the left, and the new name in 1.0.0 on the right:

  • $idle -> Idle
  • $idleProvider -> IdleProvider
  • $keepalive -> Keepalive
  • $keepaliveProvider -> KeepaliveProvider

With the exception of the renamed methods detailed below, the signatures of these services have largely remained the same. You should be able to simply search and replace $idle with Idle as well as $keepalive with KeepAlive throughout your application.

Renamed Methods on IdleProvider (formerly $idleProvider)

Some of the initial vocabulary for describing concepts was tentative, and as the module evolved became clearer. Because I'm picky, I decided to just clean these up:

  • idleDuration() -> idle()
  • warningDuration() -> timeout()
  • activeOn() -> interrupt()

Renamed Events

The $ prefix was also removed from event names to remain consistent. Below are the renamed events.

  • $keepaliveResponse -> KeepaliveResponse
  • $idleStart -> IdleStart
  • $idleEnd -> IdleEnd
  • $idleWarn -> IdleWarn
  • $idleTimeout -> IdleTimeout

The event parameters have otherwise not changed. If you searched and replaced the service names as mentioned above, the event names will also likely also have been updated.

Renamed Directives

Dropped the ng- prefix from directives.

  • ngIdleCountdown -> IdleCountdown (HTML: ng-idle-countdown -> idle-countdown)