Skip to content

Commit 320090d

Browse files
committed
Updated NEXT libs and docs
1 parent 2678a12 commit 320090d

File tree

9 files changed

+188
-56
lines changed

9 files changed

+188
-56
lines changed

VERSIONS.txt

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,16 @@
1-
Version NEXT [Not yet released]
1+
Version 1.0.0 (September 14, 2017)
22
****************************************************************************************************
33
CRITICAL
44
- removed deprecated properties, particularly getValue/setValue properties, in favour of .value
55
this particularly affects instance and global properties like mute, volume, pan, etc.
66
- removed deprecated TYPE duplicates, notably the loader types (LoadQueue.SOUND, AbstractLoader.SOUND)
77
in place of the Types.SOUND, and request methods (LoadQueue.POST, AbstractLoader.POST) in place
88
of Methods.POST.
9+
- Deprecated get/set methods are now protect with an underscore (eg _setEnabled)
10+
The deprecated methods and properties will still work, but will display a console warning when used.
11+
- Sound.play is no longer overloaded, and only takes a source and an initialization object
12+
(or PlayPropsConfig) instead of a bunch of arguments. A console warning will be displayed if the
13+
old approach is used, and additional arguments will be ignored.
914

1015
*****
1116
- changed XHR error conditions to only include 400-599. Specifically removed status=0 as an error,
@@ -16,6 +21,8 @@ CRITICAL
1621
- added missing Methods and Types classes from recent PreloadJS changes
1722
- handled case where audio duration returned < 0, resulting in a DOM Error
1823
- fixed issue where new instances wouldn't get the global mute/volume (thanks @PythonFanboy)
24+
- added a shared createjs.deprecate() method, which wraps old methods and property getter/setters to display
25+
a console warning when used.
1926

2027

2128
Version 0.6.2 [November 26, 2015]

_assets/libs/easeljs-NEXT.min.js

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

_assets/libs/preloadjs-NEXT.min.js

Lines changed: 3 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

_assets/libs/tweenjs-NEXT.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

bower.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "SoundJS",
3-
"version": "0.6.2",
3+
"version": "1.0.0",
44
"homepage": "https://github.com/CreateJS/SoundJS",
55
"authors": [
66
"lannymcnie",
@@ -9,7 +9,7 @@
99
"wdamien"
1010
],
1111
"description": "A Javascript library for working with Audio. Features a simple interface as the front end to multiple audio APIs via a plugin model. Currently supports WebAudio, HTML5 Audio, and a Flash fallback. Part of the CreateJS suite of libraries.",
12-
"main": "lib/soundjs-0.6.2.combined.js",
12+
"main": "lib/soundjs-1.0.0.combined.js",
1313
"keywords": [
1414
"sound",
1515
"audio",

build/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "SoundJS",
3-
"version": "0.6.2",
3+
"version": "1.0.0",
44
"description": "SoundJS Docs",
55
"url": "http://www.createjs.com/soundjs",
66
"logo": "assets/docs-icon-SoundJS.png",

docs/soundjs_docs-NEXT.zip

5.29 KB
Binary file not shown.

lib/soundjs-NEXT.combined.js

Lines changed: 167 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ this.createjs = this.createjs || {};
5757
* @type String
5858
* @static
5959
**/
60-
s.buildDate = /*=date*/"Wed, 21 Jun 2017 16:53:32 GMT"; // injected by build process
60+
s.buildDate = /*=date*/"Thu, 14 Sep 2017 22:19:45 GMT"; // injected by build process
6161

6262
})();
6363

@@ -157,6 +157,48 @@ createjs.promote = function(subclass, prefix) {
157157
return subclass;
158158
};
159159

160+
//##############################################################################
161+
// deprecate.js
162+
//##############################################################################
163+
164+
this.createjs = this.createjs||{};
165+
166+
/**
167+
* @class Utility Methods
168+
*/
169+
170+
/**
171+
* Wraps deprecated methods so they still be used, but throw warnings to developers.
172+
*
173+
* obj.deprecatedMethod = createjs.deprecate("Old Method Name", obj._fallbackMethod);
174+
*
175+
* The recommended approach for deprecated properties is:
176+
*
177+
* try {
178+
* Obj ect.defineProperties(object, {
179+
* readyOnlyProp: { get: createjs.deprecate("readOnlyProp", function() { return this.alternateProp; }) },
180+
* readWriteProp: {
181+
* get: createjs.deprecate("readOnlyProp", function() { return this.alternateProp; }),
182+
* set: createjs.deprecate("readOnlyProp", function(val) { this.alternateProp = val; })
183+
* });
184+
* } catch (e) {}
185+
*
186+
* @method deprecate
187+
* @param {Function} [fallbackMethod=null] A method to call when the deprecated method is used. See the example for how
188+
* @param {String} [name=null] The name of the method or property to display in the console warning.
189+
* to deprecate properties.
190+
* @return {Function} If a fallbackMethod is supplied, returns a closure that will call the fallback method after
191+
* logging the warning in the console.
192+
*/
193+
createjs.deprecate = function(fallbackMethod, name) {
194+
"use strict";
195+
return function() {
196+
var msg = "Deprecated property or method '"+name+"'. See docs for info.";
197+
console && (console.warn ? console.warn(msg) : console.log(msg));
198+
return fallbackMethod && fallbackMethod.apply(this, arguments);
199+
}
200+
};
201+
160202
//##############################################################################
161203
// indexOf.js
162204
//##############################################################################
@@ -2029,6 +2071,30 @@ this.createjs = this.createjs || {};
20292071
var p = createjs.extend(AbstractLoader, createjs.EventDispatcher);
20302072
var s = AbstractLoader;
20312073

2074+
// Remove these @deprecated properties after 1.0
2075+
try {
2076+
Object.defineProperties(s, {
2077+
POST: { get: createjs.deprecate(function() { return createjs.Methods.POST; }, "AbstractLoader.POST") },
2078+
GET: { get: createjs.deprecate(function() { return createjs.Methods.GET; }, "AbstractLoader.GET") },
2079+
2080+
BINARY: { get: createjs.deprecate(function() { return createjs.Types.BINARY; }, "AbstractLoader.BINARY") },
2081+
CSS: { get: createjs.deprecate(function() { return createjs.Types.CSS; }, "AbstractLoader.CSS") },
2082+
FONT: { get: createjs.deprecate(function() { return createjs.Types.FONT; }, "AbstractLoader.FONT") },
2083+
FONTCSS: { get: createjs.deprecate(function() { return createjs.Types.FONTCSS; }, "AbstractLoader.FONTCSS") },
2084+
IMAGE: { get: createjs.deprecate(function() { return createjs.Types.IMAGE; }, "AbstractLoader.IMAGE") },
2085+
JAVASCRIPT: { get: createjs.deprecate(function() { return createjs.Types.JAVASCRIPT; }, "AbstractLoader.JAVASCRIPT") },
2086+
JSON: { get: createjs.deprecate(function() { return createjs.Types.JSON; }, "AbstractLoader.JSON") },
2087+
JSONP: { get: createjs.deprecate(function() { return createjs.Types.JSONP; }, "AbstractLoader.JSONP") },
2088+
MANIFEST: { get: createjs.deprecate(function() { return createjs.Types.MANIFEST; }, "AbstractLoader.MANIFEST") },
2089+
SOUND: { get: createjs.deprecate(function() { return createjs.Types.SOUND; }, "AbstractLoader.SOUND") },
2090+
VIDEO: { get: createjs.deprecate(function() { return createjs.Types.VIDEO; }, "AbstractLoader.VIDEO") },
2091+
SPRITESHEET: { get: createjs.deprecate(function() { return createjs.Types.SPRITESHEET; }, "AbstractLoader.SPRITESHEET") },
2092+
SVG: { get: createjs.deprecate(function() { return createjs.Types.SVG; }, "AbstractLoader.SVG") },
2093+
TEXT: { get: createjs.deprecate(function() { return createjs.Types.TEXT; }, "AbstractLoader.TEXT") },
2094+
XML: { get: createjs.deprecate(function() { return createjs.Types.XML; }, "AbstractLoader.XML") }
2095+
});
2096+
} catch (e) {}
2097+
20322098
// Events
20332099
/**
20342100
* The {{#crossLink "ProgressEvent"}}{{/crossLink}} that is fired when the overall progress changes. Prior to
@@ -3629,10 +3695,12 @@ this.createjs = this.createjs || {};
36293695
* @static
36303696
*/
36313697
s.create = function (value) {
3632-
if (value == null || value instanceof s || value instanceof Object) {
3633-
var ppc = new createjs.PlayPropsConfig();
3634-
ppc.set(value);
3635-
return ppc;
3698+
if (typeof(value) === "string") {
3699+
// Handle the old API gracefully.
3700+
console && (console.warn || console.log)("Deprecated behaviour. Sound.play takes a configuration object instead of individual arguments. See docs for info.");
3701+
return new createjs.PlayPropsConfig().set({interrupt:value});
3702+
} else if (value == null || value instanceof s || value instanceof Object) {
3703+
return new createjs.PlayPropsConfig().set(value);
36363704
} else if (value == null) {
36373705
throw new Error("PlayProps configuration not recognized.");
36383706
}
@@ -4039,36 +4107,63 @@ this.createjs = this.createjs || {};
40394107

40404108

40414109
// class getter / setter properties
4110+
40424111
/**
40434112
* Set the master volume of Sound. The master volume is multiplied against each sound's individual volume. For
40444113
* example, if master volume is 0.5 and a sound's volume is 0.5, the resulting volume is 0.25. To set individual
4045-
* sound volume, use AbstractSoundInstance {{#crossLink "AbstractSoundInstance/volume:property"}}{{/crossLink}} instead.
4114+
* sound volume, use AbstractSoundInstance {{#crossLink "AbstractSoundInstance/volume:property"}}{{/crossLink}}
4115+
* instead.
40464116
*
40474117
* <h4>Example</h4>
40484118
*
40494119
* createjs.Sound.volume = 0.5;
40504120
*
4051-
*
40524121
* @property volume
40534122
* @type {Number}
40544123
* @default 1
40554124
* @since 0.6.1
40564125
*/
4126+
4127+
/**
4128+
* The internal volume level. Use {{#crossLink "Sound/volume:property"}}{{/crossLink}} to adjust the master volume.
4129+
* @property _masterVolume
4130+
* @type {number}
4131+
* @default 1
4132+
* @private
4133+
*/
40574134
s._masterVolume = 1;
4058-
Object.defineProperty(s, "volume", {
4059-
get: function () {return this._masterVolume;},
4060-
set: function (value) {
4061-
if (Number(value) == null) {return false;}
4062-
value = Math.max(0, Math.min(1, value));
4063-
s._masterVolume = value;
4064-
if (!this.activePlugin || !this.activePlugin.setVolume || !this.activePlugin.setVolume(value)) {
4065-
var instances = this._instances;
4066-
for (var i = 0, l = instances.length; i < l; i++) {
4067-
instances[i].setMasterVolume(value);
4068-
}
4069-
}
4135+
4136+
/**
4137+
* Use the {{#crossLink "Sound/volume:property"}}{{/crossLink}} property instead.
4138+
* @method _getMasterVolume
4139+
* @private
4140+
* @static
4141+
* @return {Number}
4142+
**/
4143+
s._getMasterVolume = function() {
4144+
return this._masterVolume;
4145+
};
4146+
// Sound.getMasterVolume is @deprecated. Remove for 1.1+
4147+
s.getVolume = createjs.deprecate(s._getMasterVolume, "Sound.getVolume");
4148+
/**
4149+
* Use the {{#crossLink "Sound/volume:property"}}{{/crossLink}} property instead.
4150+
* @method _setMasterVolume
4151+
* @static
4152+
* @private
4153+
**/
4154+
s._setMasterVolume = function(value) {
4155+
if (Number(value) == null) { return; }
4156+
value = Math.max(0, Math.min(1, value));
4157+
s._masterVolume = value;
4158+
if (!this.activePlugin || !this.activePlugin.setVolume || !this.activePlugin.setVolume(value)) {
4159+
var instances = this._instances;
4160+
for (var i = 0, l = instances.length; i < l; i++) {
4161+
instances[i].setMasterVolume(value);
40704162
}
4071-
});
4163+
}
4164+
};
4165+
// Sound.stMasterVolume is @deprecated. Remove for 1.1+
4166+
s.setVolume = createjs.deprecate(s._setMasterVolume, "Sound.setVolume");
40724167

40734168
/**
40744169
* Mute/Unmute all audio. Note that muted audio still plays at 0 volume. This global mute value is maintained
@@ -4086,22 +4181,39 @@ this.createjs = this.createjs || {};
40864181
* @since 0.6.1
40874182
*/
40884183
s._masterMute = false;
4089-
// OJR references to the methods were not working, so the code had to be duplicated here
4090-
Object.defineProperty(s, "muted", {
4091-
get: function () {return this._masterMute;},
4092-
set: function (value) {
4093-
if (value == null) {return false;}
4094-
4095-
this._masterMute = value;
4096-
if (!this.activePlugin || !this.activePlugin.setMute || !this.activePlugin.setMute(value)) {
4097-
var instances = this._instances;
4098-
for (var i = 0, l = instances.length; i < l; i++) {
4099-
instances[i].setMasterMute(value);
4100-
}
4101-
}
4102-
return true;
4184+
4185+
/**
4186+
* Use the {{#crossLink "Sound/muted:property"}}{{/crossLink}} property instead.
4187+
* @method _getMute
4188+
* @returns {Boolean}
4189+
* @static
4190+
* @private
4191+
*/
4192+
s._getMute = function () {
4193+
return this._masterMute;
4194+
};
4195+
// Sound.getMute is @deprecated. Remove for 1.1+
4196+
s.getMute = createjs.deprecate(s._getMute, "Sound.getMute");
4197+
4198+
/**
4199+
* Use the {{#crossLink "Sound/muted:property"}}{{/crossLink}} property instead.
4200+
* @method _setMute
4201+
* @param {Boolean} value The muted value
4202+
* @static
4203+
* @private
4204+
*/
4205+
s._setMute = function (value) {
4206+
if (value == null) { return; }
4207+
this._masterMute = value;
4208+
if (!this.activePlugin || !this.activePlugin.setMute || !this.activePlugin.setMute(value)) {
4209+
var instances = this._instances;
4210+
for (var i = 0, l = instances.length; i < l; i++) {
4211+
instances[i].setMasterMute(value);
41034212
}
4104-
});
4213+
}
4214+
};
4215+
// Sound.setMute is @deprecated. Remove for 1.1+
4216+
s.setMute = createjs.deprecate(s._setMute, "Sound.setMute");
41054217

41064218
/**
41074219
* Get the active plugins capabilities, which help determine if a plugin can be used in the current environment,
@@ -4137,12 +4249,23 @@ this.createjs = this.createjs || {};
41374249
* @readOnly
41384250
* @since 0.6.1
41394251
*/
4140-
Object.defineProperty(s, "capabilities", {
4141-
get: function () {
4142-
if (s.activePlugin == null) {return null;}
4143-
return s.activePlugin._capabilities;
4144-
},
4145-
set: function (value) { return false;}
4252+
4253+
/**
4254+
* Use the {{#crossLink "Sound/capabilities:property"}}{{/crossLink}} property instead.
4255+
* @returns {null}
4256+
* @private
4257+
*/
4258+
s._getCapabilities = function() {
4259+
if (s.activePlugin == null) { return null; }
4260+
return s.activePlugin._capabilities;
4261+
};
4262+
// Sound.getCapabilities is @deprecated. Remove for 1.1+
4263+
s.getCapabilities = createjs.deprecate(s._getCapabilities, "Sound.getCapabilities");
4264+
4265+
Object.defineProperties(s, {
4266+
volume: { get: s._getMasterVolume, set: s._setMasterVolume },
4267+
muted: { get: s._getMute, set: s._setMute },
4268+
capabilities: { get: s._getCapabilities }
41464269
});
41474270

41484271

@@ -7158,8 +7281,9 @@ this.createjs = this.createjs || {};
71587281
s._createAudioContext = function() {
71597282
// Slightly modified version of https://github.com/Jam3/ios-safe-audio-context
71607283
// Resolves issues with first-run contexts playing garbled on iOS.
7161-
var AudioCtor = (window.AudioContext || window.webkitAudioContext),
7162-
context = new AudioCtor();
7284+
var AudioCtor = (window.AudioContext || window.webkitAudioContext);
7285+
if (AudioCtor == null) { return null; }
7286+
var context = new AudioCtor();
71637287

71647288
// Check if hack is necessary. Only occurs in iOS6+ devices
71657289
// and only when you first boot the iPhone, or play a audio/video

lib/soundjs-NEXT.min.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)