Skip to content

Instantly share code, notes, and snippets.

@amitpdev
Last active April 9, 2017 19:14
Show Gist options
  • Save amitpdev/4badf35a2a514ff8ebdd2c5de99e184e to your computer and use it in GitHub Desktop.
Save amitpdev/4badf35a2a514ff8ebdd2c5de99e184e to your computer and use it in GitHub Desktop.
A simple Singleton for Cloudinary on ES6 JS
import * as cloudinary from 'cloudinary-core';
class CloudinaryManager {
static get shared() {
if (this.instance == null || this.instance == undefined) {
this.instance = cloudinary.Cloudinary.new();
this.instance.config('cloud_name', 'mycloudname');
}
return this.instance;
}
}
let imageURL = CloudinaryManager.shared.url('myimageid')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment