Skip to content
This repository has been archived by the owner on Mar 30, 2024. It is now read-only.

CloudKidStudio/CEPExtension

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

#CEP Extension#

Abstract API for creating Adobe CEP (formerly CSXS) Extensions. The CEPExtension is a re-write of the horrible JavaScript code generated by Adobe Extension Builder. This provides an object oriented way to create extension objects.

##Installation##

Installation is available using Bower.

bower install cep-extension

##Usage##

Include both the JavaScript and CSS files into your extension. See the example here:

<!doctype html>
<html>
	<head>
		<title>Hello World</title>
		<meta charset="utf-8">
		<!-- Available from http://adobe-cep.github.io/CEP-Resources/ -->
		<script src="js/CSInterface.js"></script>
		<!-- Add jQuery your local project -->
		<script src="http://code.jquery.com/jquery-1.11.0.min.js"></script>
		<!-- Add into your local project -->
		<script src="js/cep-extension.js"></script>
		<!-- Add in the required CSS -->
		<link rel="stylesheet" type="text/css" href="css/cep-extension.css">
	</head>
	<body>
		<button class="button" id="newDoc">New Document</button>
		<script>
			// Create the extension
			var extension = new CEPExtension("#stylesheet", "com.cloudkid.HelloWorld");
			// Add a click hander and execute some JSFL code
			$("#newDoc").click(function(){
				extension.execute("fl.createDocument('timeline');");
			});
		</script>
	</body>
</html>

##Extending##

CEPExtension object is easy to extend. Here's a standard JavaScript inheritance example.

(function(window){
	
	'use strict';

	/**
	*  Create the new extension and extend Hello World 
	*  @class HelloWorld
	*  @extends CEPExtension
	*  @param {String} stylesheet The stylesheet selector
	*/
	var HelloWorld = function(stylesheet)
	{
		CEPExtension.call(this, stylesheet, "com.cloudkid.HelloWorld");
	};
	
	// Extend the prototype to the CEPExtension object
	var p = HelloWorld.prototype = Object.create(CEPExtension.prototype);
	
	// Set the constructor
	p.constructor = HelloWorld;

	// Assign to global scope
	window.HelloWorld = HelloWorld;

}(window));

##License##

Copyright (c) 2014 CloudKid

Released under the MIT License.

About

Abstract API for creating HTML5 Adobe CEP Extensions

Resources

License

Stars

Watchers

Forks

Packages

No packages published