Skip to content

Latest commit

 

History

History
59 lines (47 loc) · 1.08 KB

MIGRATION.md

File metadata and controls

59 lines (47 loc) · 1.08 KB

V2 to V3

The way of importing the library has changed in this v3 in order to make it compatible with ES6 and Typescript. The changes are:

Script Load

Before:

<script src="lib/easytimer/dist/easytimer.min.js"></script>
<script>
    var timerInstance = new Timer();
</script>

Now:

<script src="lib/easytimer/dist/easytimer.min.js"></script>
<script>
    var timerInstance = new easytimer.Timer();
</script>

Node

Before:

var Timer = require('easytimer.js');
var timerInstance = new Timer();

Now:

var Timer = require('easytimer.js').Timer;
var timerInstance = new Timer();

// or 

var { Timer } = require('easytimer.js');
var timerInstance = new Timer();

AMD

require(['node_modules/easytimer.js/dist/easytimer.min.js'], function (Timer) {
    var timer = new Timer();
});

Now:

require(['node_modules/easytimer.js/dist/easytimer.min.js'], function (easytimer) {
    var timer = new easytimer.Timer();
});

// or

require(['node_modules/easytimer.js/dist/easytimer.min.js'], function ({ Timer }) {
    var timer = new Timer();
});