From f1a0604ba0abe5accc6ea3158d866f57f87953b4 Mon Sep 17 00:00:00 2001 From: Katsuyuki Ohmuro Date: Tue, 29 Apr 2014 11:24:59 +0900 Subject: Begin adding support for RequireJS --- CHANGELOG.md | 5 +++++ pollymer.js | 60 +++++++++++++++++++++++++++++++++++------------------------- 2 files changed, 40 insertions(+), 25 deletions(-) create mode 100644 CHANGELOG.md diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..cc2abe7 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,5 @@ +Pollymer Changelog +================== + +v. 1.0.0 (01-31-2013) - Initial Release. +v. 1.1.0 (xx-xx-xxxx) - Support for RequireJS (AMD). \ No newline at end of file diff --git a/pollymer.js b/pollymer.js index fa0f708..23ee92b 100644 --- a/pollymer.js +++ b/pollymer.js @@ -1,25 +1,39 @@ /** - * Pollymer JavaScript Library v1.0.0 + * Pollymer JavaScript Library v1.1.0 * Copyright 2013 Fanout, Inc. * Released under the MIT license (see COPYING file in source distribution) */ -(function () { -"use strict"; -var DEBUG = true; -(function (window, undefined) { +(function(factory) { + "use strict"; + var DEBUG = true; + var isWindow = function(variable) { + return variable && variable.document && variable.location && variable.alert && variable.setInterval; + } + if (!isWindow(window)) { + throw "The current version of Pollymer may only be used within the context of a browser."; + } + var debugMode = DEBUG && typeof(window.console) !== "undefined"; + if (typeof define === 'function' && define['amd']) { + // AMD anonymous module + define(['exports'], function(exports) { factory(exports, window, debugMode); }); + } else { + // No module loader (plain