-
Notifications
You must be signed in to change notification settings - Fork 25
use via AMD or CMD
Leon Shi edited this page Dec 13, 2015
·
1 revision
Use via AMD, such as require.js
<img id="preview" alt="imageClipper preview">
<script src="/path/to/require.js"></script>
<script>
define(function() {
var imageClipper = require('./dist/imageClipper.js');
imageClipper('/path/to/image.jpg', function() {
this.crop(x, y, width, height)
.toDataURL(function(dataUrl) {
console.log('cropped!');
preview.src = dataUrl;
});
});
});
</script>
Use via CMD, such as sea.js
<script src="/path/to/sea.js"></script>
<script>
seajs.use('./dist/imageClipper.js', function(imageClipper){
imageClipper('/path/to/image.jpg', function() {
this.crop(x, y, width, height)
.toDataURL(function(dataUrl) {
console.log('cropped!');
preview.src = dataUrl;
});
});
})
</script>