Socket
Socket
Sign inDemoInstall

flat-embed

Package Overview
Dependencies
Maintainers
2
Versions
27
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

flat-embed - npm Package Compare versions

Comparing version 1.2.0 to 1.3.0

21

CHANGELOG.md
# Changelog
## v1.3.0
* Add methods:
* `getMasterVolume`
* `setMasterVolume`
* `getPartVolume`
* `setPartVolume`
* `mutePart`
* `unmutePart`
* `setPartSoloMode`
* `unsetPartSoloMode`
* `getPartSoloMode`
* `getPartReverb`
* `setPartReverb`
* `getMeasureDetails`
* `getNoteDetails`
* Add events:
* `noteDetails`
* `measureDetails`
* `cursorContext`
## v1.2.0

@@ -4,0 +25,0 @@

147

dist/embed.js

@@ -1,2 +0,2 @@

/*! flat-embed v1.2.0 | (c) 2020 Tutteo Ltd. (Flat) | Apache-2.0 License | https://github.com/FlatIO/embed-client */
/*! flat-embed v1.3.0 | (c) 2020 Tutteo Ltd. (Flat) | Apache-2.0 License | https://github.com/FlatIO/embed-client */
(function (global, factory) {

@@ -634,2 +634,123 @@ typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :

/**
* Get the current master volume
*
* @return {Promise}
*/
}, {
key: "getMasterVolume",
value: function getMasterVolume() {
return this.call('getMasterVolume');
}
/**
* Get the current master volume
*
* @return {Promise}
*/
}, {
key: "setMasterVolume",
value: function setMasterVolume(parameters) {
return this.call('getMasterVolume', parameters);
}
/**
* Get the volume of a part
*
* @return {Promise}
*/
}, {
key: "getPartVolume",
value: function getPartVolume(parameters) {
return this.call('getPartVolume', parameters);
}
/**
* Set the volume of a part
*
* @return {Promise}
*/
}, {
key: "setPartVolume",
value: function setPartVolume(parameters) {
return this.call('setPartVolume', parameters);
}
/**
* Mute a part
*
* @return {Promise}
*/
}, {
key: "mutePart",
value: function mutePart(parameters) {
return this.call('mutePart', parameters);
}
/**
* Mute a part
*
* @return {Promise}
*/
}, {
key: "unmutePart",
value: function unmutePart(parameters) {
return this.call('unmutePart', parameters);
}
/**
* Enable the solo mode for a part
*
* @return {Promise}
*/
}, {
key: "setPartSoloMode",
value: function setPartSoloMode(parameters) {
return this.call('setPartSoloMode', parameters);
}
/**
* Disable the solo mode for a part
*
* @return {Promise}
*/
}, {
key: "unsetPartSoloMode",
value: function unsetPartSoloMode(parameters) {
return this.call('unsetPartSoloMode', parameters);
}
/**
* Get the state of the solo mode of a part
*
* @return {Promise}
*/
}, {
key: "getPartSoloMode",
value: function getPartSoloMode(parameters) {
return this.call('getPartSoloMode', parameters);
}
/**
* Get the volume of a part
*
* @return {Promise}
*/
}, {
key: "getPartReverb",
value: function getPartReverb(parameters) {
return this.call('getPartReverb', parameters);
}
/**
* Set the volume of a part
*
* @return {Promise}
*/
}, {
key: "setPartReverb",
value: function setPartReverb(parameters) {
return this.call('setPartReverb', parameters);
}
/**
* Print the score

@@ -767,2 +888,26 @@ *

}
/**
* Get all the parts information
*
* @return {Promise}
* @fullfill {array} List of the parts
*/
}, {
key: "getMeasureDetails",
value: function getMeasureDetails() {
return this.call('getMeasureDetails');
}
/**
* Get all the parts information
*
* @return {Promise}
* @fullfill {array} List of the parts
*/
}, {
key: "getNoteDetails",
value: function getNoteDetails() {
return this.call('getNoteDetails');
}
}]);

@@ -769,0 +914,0 @@

4

dist/embed.min.js

@@ -1,2 +0,2 @@

/*! flat-embed v1.2.0 | (c) 2020 Tutteo Ltd. (Flat) | Apache-2.0 License | https://github.com/FlatIO/embed-client */
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):((e=e||self).Flat=e.Flat||{},e.Flat.Embed=t())}(this,function(){"use strict";function i(e){return(i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function e(e,t,n){return t&&r(e.prototype,t),n&&r(e,n),e}if(void 0===window.postMessage)throw new Error("The Flat Embed JS API is not supported in this browser");function o(e,t){var n=function(e){var t=e.baseUrl||"https://flat-embed.com";t+="/"+(e.score||"blank");var n=Object.assign({jsapi:!0},e.embedParams);return t+"?"+Object.keys(n).map(function(e){return"".concat(encodeURIComponent(e),"=").concat(encodeURIComponent(n[e]))}).join("&")}(t),r=document.createElement("iframe");return r.setAttribute("src",n),r.setAttribute("width",t.width||"100%"),r.setAttribute("height",t.height||"100%"),r.setAttribute("allowfullscreen",!0),r.setAttribute("allow","midi"),r.setAttribute("frameborder","0"),e.appendChild(r),r}function s(e,t,n){if(!e.element.contentWindow||!e.element.contentWindow.postMessage)throw new Error("No `contentWindow` or `contentWindow.postMessage` avaialble on the element");var r={method:t,parameters:n};e.element.contentWindow.postMessage(r,e.origin)}var a=function(){function t(e){return n(this,t),this.embed=e,this.promises={},this.eventCallbacks={},this}return e(t,[{key:"pushCall",value:function(e,t,n){this.promises[e]=this.promises[e]||[],this.promises[e].push({resolve:t,reject:n})}},{key:"subscribeEvent",value:function(e,t){return this.eventCallbacks[e]=this.eventCallbacks[e]||[],this.eventCallbacks[e].push(t),1===this.eventCallbacks[e].length}},{key:"unsubscribeEvent",value:function(e,t){if(!this.eventCallbacks[e])return!1;if(t){var n=this.eventCallbacks[e].indexOf(t);0<=n&&this.eventCallbacks[e].splice(n,1)}else this.eventCallbacks[e]=[];return!t||0===this.eventCallbacks[e].length}},{key:"process",value:function(e){e.method?this.processMethodResponse(e):e.event&&this.processEvent(e)}},{key:"processMethodResponse",value:function(e){if(this.promises[e.method]){var t=this.promises[e.method].shift();t&&(e.error?t.reject(e.error):t.resolve(e.response))}}},{key:"processEvent",value:function(t){var n=this;this.eventCallbacks[t.event]&&0!==this.eventCallbacks[t.event].length&&this.eventCallbacks[t.event].forEach(function(e){e.call(n.embed,t.parameters)})}}]),t}(),u=new WeakMap,l=new WeakMap;return function(){function Embed(r){var i=this,e=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{};if(n(this,Embed),r=function(e){if(window.jQuery&&e instanceof window.jQuery&&(e=e[0]),"string"==typeof e&&(e=document.getElementById(e)),!(e instanceof window.HTMLElement))throw new TypeError("The first parameter must be an existing DOM element or an identifier.");if("IFRAME"!==e.nodeName){var t=e.querySelector("iframe");t&&(e=t)}return e}(r),u.has(r))return u.get(r);"IFRAME"!==r.nodeName&&(r=o(r,e)),this.origin="*",this.element=r,this.embedCallback=new a;var t=new Promise(function(n){window.addEventListener("message",function(e){if(r.contentWindow===e.source){"*"===i.origin&&(i.origin=e.origin);var t=function(e){return"string"==typeof e&&(e=JSON.parse(e)),e}(e.data);"ready"!==t.event&&"ping"!==t.method?i.embedCallback.process(t):n()}},!1),s(i,"ping")});return u.set(this.element,this),l.set(this,t),this}return e(Embed,[{key:"ready",value:function(){return Promise.resolve(l.get(this))}},{key:"call",value:function(n){var r=this,i=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{};return new Promise(function(e,t){return r.ready().then(function(){r.embedCallback.pushCall(n,e,t),s(r,n,i)})})}},{key:"on",value:function(e,t){if("string"!=typeof e)throw new TypeError("An event name (string) is required");if("function"!=typeof t)throw new TypeError("An callback (function) is required");this.embedCallback.subscribeEvent(e,t)&&this.call("addEventListener",e).catch(function(){})}},{key:"off",value:function(e,t){if("string"!=typeof e)throw new TypeError("An event name (string) is required");this.embedCallback.unsubscribeEvent(e,t)&&this.call("removeEventListener",e).catch(function(){})}},{key:"loadFlatScore",value:function(e,t){return this.call("loadFlatScore",{score:e,revision:t})}},{key:"loadMusicXML",value:function(e){return this.call("loadMusicXML",e)}},{key:"loadJSON",value:function(e){return this.call("loadJSON",e)}},{key:"getJSON",value:function(){return this.call("getJSON")}},{key:"getMusicXML",value:function(n){var r=this;return new Promise(function(t,e){if("object"!==i(n=n||{}))return e(new TypeError("Options must be an object"));r.call("getMusicXML",n).then(function(e){return t("string"==typeof e?e:new Uint8Array(e))}).catch(e)})}},{key:"getPNG",value:function(n){var r=this;return new Promise(function(t,e){if("object"!==i(n=n||{}))return e(new TypeError("Options must be an object"));r.call("getPNG",n).then(function(e){return t("string"==typeof e?e:new Uint8Array(e))}).catch(e)})}},{key:"getMIDI",value:function(){return this.call("getMIDI").then(function(e){return new Uint8Array(e)})}},{key:"getFlatScoreMetadata",value:function(){return this.call("getFlatScoreMetadata")}},{key:"getEmbedConfig",value:function(){return this.call("getEmbedConfig")}},{key:"setEditorConfig",value:function(e){return this.call("setEditorConfig",e)}},{key:"fullscreen",value:function(e){return this.call("fullscreen",e)}},{key:"play",value:function(){return this.call("play")}},{key:"pause",value:function(){return this.call("pause")}},{key:"stop",value:function(){return this.call("stop")}},{key:"mute",value:function(){return this.call("mute")}},{key:"print",value:function(){return this.call("print")}},{key:"getZoom",value:function(){return this.call("getZoom")}},{key:"setZoom",value:function(e){return this.call("setZoom",e)}},{key:"getAutoZoom",value:function(){return this.call("getAutoZoom")}},{key:"setAutoZoom",value:function(e){return this.call("setAutoZoom",e)}},{key:"focusScore",value:function(){return this.call("focusScore")}},{key:"getCursorPosition",value:function(){return this.call("getCursorPosition")}},{key:"setCursorPosition",value:function(e){return this.call("setCursorPosition",e)}},{key:"getParts",value:function(){return this.call("getParts")}},{key:"getDisplayedParts",value:function(){return this.call("getDisplayedParts")}},{key:"setDisplayedParts",value:function(e){return this.call("setDisplayedParts",e)}}]),Embed}()});
/*! flat-embed v1.3.0 | (c) 2020 Tutteo Ltd. (Flat) | Apache-2.0 License | https://github.com/FlatIO/embed-client */
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):((e=e||self).Flat=e.Flat||{},e.Flat.Embed=t())}(this,function(){"use strict";function o(e){return(o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function e(e,t,n){return t&&r(e.prototype,t),n&&r(e,n),e}if(void 0===window.postMessage)throw new Error("The Flat Embed JS API is not supported in this browser");function i(e,t){var n=function(e){var t=e.baseUrl||"https://flat-embed.com";t+="/"+(e.score||"blank");var n=Object.assign({jsapi:!0},e.embedParams);return t+"?"+Object.keys(n).map(function(e){return"".concat(encodeURIComponent(e),"=").concat(encodeURIComponent(n[e]))}).join("&")}(t),r=document.createElement("iframe");return r.setAttribute("src",n),r.setAttribute("width",t.width||"100%"),r.setAttribute("height",t.height||"100%"),r.setAttribute("allowfullscreen",!0),r.setAttribute("allow","midi"),r.setAttribute("frameborder","0"),e.appendChild(r),r}function a(e,t,n){if(!e.element.contentWindow||!e.element.contentWindow.postMessage)throw new Error("No `contentWindow` or `contentWindow.postMessage` avaialble on the element");var r={method:t,parameters:n};e.element.contentWindow.postMessage(r,e.origin)}var s=function(){function t(e){return n(this,t),this.embed=e,this.promises={},this.eventCallbacks={},this}return e(t,[{key:"pushCall",value:function(e,t,n){this.promises[e]=this.promises[e]||[],this.promises[e].push({resolve:t,reject:n})}},{key:"subscribeEvent",value:function(e,t){return this.eventCallbacks[e]=this.eventCallbacks[e]||[],this.eventCallbacks[e].push(t),1===this.eventCallbacks[e].length}},{key:"unsubscribeEvent",value:function(e,t){if(!this.eventCallbacks[e])return!1;if(t){var n=this.eventCallbacks[e].indexOf(t);0<=n&&this.eventCallbacks[e].splice(n,1)}else this.eventCallbacks[e]=[];return!t||0===this.eventCallbacks[e].length}},{key:"process",value:function(e){e.method?this.processMethodResponse(e):e.event&&this.processEvent(e)}},{key:"processMethodResponse",value:function(e){if(this.promises[e.method]){var t=this.promises[e.method].shift();t&&(e.error?t.reject(e.error):t.resolve(e.response))}}},{key:"processEvent",value:function(t){var n=this;this.eventCallbacks[t.event]&&0!==this.eventCallbacks[t.event].length&&this.eventCallbacks[t.event].forEach(function(e){e.call(n.embed,t.parameters)})}}]),t}(),u=new WeakMap,l=new WeakMap;return function(){function Embed(r){var o=this,e=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{};if(n(this,Embed),r=function(e){if(window.jQuery&&e instanceof window.jQuery&&(e=e[0]),"string"==typeof e&&(e=document.getElementById(e)),!(e instanceof window.HTMLElement))throw new TypeError("The first parameter must be an existing DOM element or an identifier.");if("IFRAME"!==e.nodeName){var t=e.querySelector("iframe");t&&(e=t)}return e}(r),u.has(r))return u.get(r);"IFRAME"!==r.nodeName&&(r=i(r,e)),this.origin="*",this.element=r,this.embedCallback=new s;var t=new Promise(function(n){window.addEventListener("message",function(e){if(r.contentWindow===e.source){"*"===o.origin&&(o.origin=e.origin);var t=function(e){return"string"==typeof e&&(e=JSON.parse(e)),e}(e.data);"ready"!==t.event&&"ping"!==t.method?o.embedCallback.process(t):n()}},!1),a(o,"ping")});return u.set(this.element,this),l.set(this,t),this}return e(Embed,[{key:"ready",value:function(){return Promise.resolve(l.get(this))}},{key:"call",value:function(n){var r=this,o=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{};return new Promise(function(e,t){return r.ready().then(function(){r.embedCallback.pushCall(n,e,t),a(r,n,o)})})}},{key:"on",value:function(e,t){if("string"!=typeof e)throw new TypeError("An event name (string) is required");if("function"!=typeof t)throw new TypeError("An callback (function) is required");this.embedCallback.subscribeEvent(e,t)&&this.call("addEventListener",e).catch(function(){})}},{key:"off",value:function(e,t){if("string"!=typeof e)throw new TypeError("An event name (string) is required");this.embedCallback.unsubscribeEvent(e,t)&&this.call("removeEventListener",e).catch(function(){})}},{key:"loadFlatScore",value:function(e,t){return this.call("loadFlatScore",{score:e,revision:t})}},{key:"loadMusicXML",value:function(e){return this.call("loadMusicXML",e)}},{key:"loadJSON",value:function(e){return this.call("loadJSON",e)}},{key:"getJSON",value:function(){return this.call("getJSON")}},{key:"getMusicXML",value:function(n){var r=this;return new Promise(function(t,e){if("object"!==o(n=n||{}))return e(new TypeError("Options must be an object"));r.call("getMusicXML",n).then(function(e){return t("string"==typeof e?e:new Uint8Array(e))}).catch(e)})}},{key:"getPNG",value:function(n){var r=this;return new Promise(function(t,e){if("object"!==o(n=n||{}))return e(new TypeError("Options must be an object"));r.call("getPNG",n).then(function(e){return t("string"==typeof e?e:new Uint8Array(e))}).catch(e)})}},{key:"getMIDI",value:function(){return this.call("getMIDI").then(function(e){return new Uint8Array(e)})}},{key:"getFlatScoreMetadata",value:function(){return this.call("getFlatScoreMetadata")}},{key:"getEmbedConfig",value:function(){return this.call("getEmbedConfig")}},{key:"setEditorConfig",value:function(e){return this.call("setEditorConfig",e)}},{key:"fullscreen",value:function(e){return this.call("fullscreen",e)}},{key:"play",value:function(){return this.call("play")}},{key:"pause",value:function(){return this.call("pause")}},{key:"stop",value:function(){return this.call("stop")}},{key:"mute",value:function(){return this.call("mute")}},{key:"getMasterVolume",value:function(){return this.call("getMasterVolume")}},{key:"setMasterVolume",value:function(e){return this.call("getMasterVolume",e)}},{key:"getPartVolume",value:function(e){return this.call("getPartVolume",e)}},{key:"setPartVolume",value:function(e){return this.call("setPartVolume",e)}},{key:"mutePart",value:function(e){return this.call("mutePart",e)}},{key:"unmutePart",value:function(e){return this.call("unmutePart",e)}},{key:"setPartSoloMode",value:function(e){return this.call("setPartSoloMode",e)}},{key:"unsetPartSoloMode",value:function(e){return this.call("unsetPartSoloMode",e)}},{key:"getPartSoloMode",value:function(e){return this.call("getPartSoloMode",e)}},{key:"getPartReverb",value:function(e){return this.call("getPartReverb",e)}},{key:"setPartReverb",value:function(e){return this.call("setPartReverb",e)}},{key:"print",value:function(){return this.call("print")}},{key:"getZoom",value:function(){return this.call("getZoom")}},{key:"setZoom",value:function(e){return this.call("setZoom",e)}},{key:"getAutoZoom",value:function(){return this.call("getAutoZoom")}},{key:"setAutoZoom",value:function(e){return this.call("setAutoZoom",e)}},{key:"focusScore",value:function(){return this.call("focusScore")}},{key:"getCursorPosition",value:function(){return this.call("getCursorPosition")}},{key:"setCursorPosition",value:function(e){return this.call("setCursorPosition",e)}},{key:"getParts",value:function(){return this.call("getParts")}},{key:"getDisplayedParts",value:function(){return this.call("getDisplayedParts")}},{key:"setDisplayedParts",value:function(e){return this.call("setDisplayedParts",e)}},{key:"getMeasureDetails",value:function(){return this.call("getMeasureDetails")}},{key:"getNoteDetails",value:function(){return this.call("getNoteDetails")}}]),Embed}()});
{
"name": "flat-embed",
"version": "1.2.0",
"version": "1.3.0",
"description": "Interact and get events from Flat's Sheet Music Embed",

@@ -50,3 +50,3 @@ "license": "Apache-2.0",

"karma-mocha-reporter": "^2.2.5",
"mocha": "^6.1.4",
"mocha": "^7.0.0",
"rollup": "^1.11.3",

@@ -53,0 +53,0 @@ "rollup-plugin-babel": "^4.3.2",

@@ -10,3 +10,3 @@ # Flat Sheet Music Embed Client

If you have any feedback or questions regarding this product, [please feel free to contact our developers support](mailto:developers@flat.io).
If you have any feedback or questions regarding this product, [please feel free to contact our developers' support](mailto:developers@flat.io).

@@ -25,3 +25,3 @@ ## Installation

```html
<script src="https://prod.flat-cdn.com/embed-js/v1.2.0/embed.min.js"></script>
<script src="https://prod.flat-cdn.com/embed-js/v1.3.0/embed.min.js"></script>
```

@@ -35,3 +35,3 @@

<div id="embed-container"></div>
<script src="https://prod.flat-cdn.com/embed-js/v1.2.0/embed.min.js"></script>
<script src="https://prod.flat-cdn.com/embed-js/v1.3.0/embed.min.js"></script>
<script>

@@ -83,7 +83,7 @@ var container = document.getElementById('embed-container');

If you instance different `Flat.Embed` for the same element, you will always get the same instance of the object.
If you instance a different `Flat.Embed` for the same element, you will always get the same instance of the object.
### Options and URL parameters
When instantiating `Flat.Embed`, you can pass options in the second parameter. In order to use the different methods available and events subscriptions, you will need to pass at least `embedParams.appId`.
When instantiating `Flat.Embed`, you can pass options in the second parameter. To use the different methods available and events subscriptions, you will need to pass at least `embedParams.appId`.

@@ -117,2 +117,13 @@ | Option | Description | Values | Default |

* [`mute`](#mute-promisevoid-error): Mute playback
* [`getMasterVolume`](#getmastervolume-promisenumber-error): Get the master volume
* [`setMasterVolume`](#setmastervolume-volume-number-promisevoid-error): Set the master volume
* [`getPartVolume`](#getpartvolume-partuuid-string-promisenumber-error): Get a part volume
* [`setPartVolume`](#setpartvolume-partuuid-string-volume-number-promisevoid-error): Set a part volume
* [`mutePart`](#mutepart-partuuid-string-promisevoid-error): Mute a part
* [`unmutePart`](#unmutepart-partuuid-string-promisevoid-error): Unmute a part
* [`setPartSoloMode`](#setpartsolomode-partuuid-string-promisevoid-error): Enable the solo mode for a part
* [`unsetPartSoloMode`](#unsetpartsolomode-partuuid-string-promisevoid-error): Disable the solo mode for a part
* [`getPartSoloMode`](#getpartsolomode-partuuid-string-promiseboolean-error): Get the state of the solo mode of a part
* [`getPartReverb`](#getpartreverb-partuuid-string-promisenumber-error): Get a part reverberation
* [`setPartReverb`](#setpartreverb-partuuid-string-reverberation-number-promisevoid-error): Set a part reverberation
* [`print`](#print-promisevoid-error): Print the score

@@ -129,2 +140,4 @@ * [`getZoom`](#getzoom-promisenumber-error): Get the current display zoom ratio

* [`setDisplayedParts`](#setdisplayedpartsparts-promisevoid-error): Choose the parts to display
* [`getMeasureDetails`](#getmeasuredetails-promiseobject-error): Get details about the current measure
* [`getNoteDetails`](#getnotedetails-promiseobject-error): Get details about the current note
* [Editor API](#editor-api)

@@ -134,2 +147,5 @@ * [Events API](#events-api)

* [`cursorPosition`](#event-cursorposition): The cursor position changed
* [`cursorContext`](#event-cursorcontext): Additional context about current cursor
* [`measureDetails`](#event-measuredetails): Details about current measure changed
* [`noteDetails`](#event-notedetails): Details about current note changed
* [`rangeSelection`](#event-rangeSelection): The range selected changed

@@ -157,3 +173,3 @@ * [`fullscreen`](#event-fullscreen): The fullscreen state changed

Promises resolved when the embed is loaded and the JavaScript API is ready to use. All the methods will implicitly use this method, so you don't have to worry about waiting the loading before calling the different methods.
Promises resolved when the embed is loaded and the JavaScript API is ready to use. All the methods will implicitly use this method, so you don't have to worry about waiting for the loading before calling the different methods.

@@ -168,3 +184,3 @@ ```js

Add an event listener for the specified event. When receiving the event, the client will call the specified function with zero or one parameters depending of the [event received](#events-api).
Add an event listener for the specified event. When receiving the event, the client will call the specified function with zero or one parameter depending on the [event received](#events-api).

@@ -179,3 +195,3 @@ ```js

Remove an event listener for the specified event. If no `callback` is specified, all the listener for the event will be removed.
Remove an event listener for the specified event. If no `callback` is specified, all the listeners for the event will be removed.

@@ -263,3 +279,3 @@ ```js

Convert the current displayed score into a MusicXML file, compressed (`.mxl`) or not (`.xml`).
Convert the currently displayed score into a MusicXML file, compressed (`.mxl`) or not (`.xml`).

@@ -309,3 +325,3 @@ ```js

Get the current displayed score as a PNG file
Get the currently displayed score as a PNG file

@@ -330,3 +346,3 @@ ```js

Get the current displayed score as a MIDI file
Get the currently displayed score as a MIDI file

@@ -402,4 +418,118 @@ ```js

### `print(): Promise<void, Error>`
### `getMasterVolume(): Promise<Number, Error>`
Get the master volume
```js
embed.getMasterVolume().then(function (volume) {
// The volume value
console.log(volume);
});
```
### `setMasterVolume({ volume: number }): Promise<void, Error>`
Set the master volume (`volume` between 0 and 100)
```js
embed.setMasterVolume({ volume: 50 }).then(function () {
// The volume is set
});
```
### `getPartVolume({ partUuid: string }): Promise<Number, Error>`
Get a part volume (`partUuid` can be retrieved with `getParts`)
```js
embed.getPartVolume({ partUuid: 'c86be847-a7a1-54fb-44fc-a6564d7eb75c' }).then(function (volume) {
// The volume value
console.log(volume);
});
```
### `setPartVolume({ partUuid: string, volume: number }): Promise<void, Error>`
Set a part volume (`volume` between 0 and 100, `partUuid` can be retrieved with `getParts`)
```js
embed.getPartVolume({ partUuid: 'c86be847-a7a1-54fb-44fc-a6564d7eb75c', volume: 50 }).then(function () {
// The volume is set
});
```
## `mutePart({ partUuid: string }): Promise<void, Error>`
Mute a part
```js
embed.mutePart({ partUuid: 'c86be847-a7a1-54fb-44fc-a6564d7eb75c' }).then(function () {
// The part is muted
});
```
## `unmutePart({ partUuid: string }): Promise<void, Error>`
Unmute a part
```js
embed.unmutePart({ partUuid: 'c86be847-a7a1-54fb-44fc-a6564d7eb75c' }).then(function () {
// The part is unmuted
});
```
## `setPartSoloMode({ partUuid: string }): Promise<void, Error>`
Enable the solo mode for a part
```js
embed.setPartSoloMode({ partUuid: 'c86be847-a7a1-54fb-44fc-a6564d7eb75c' }).then(function () {
// The part is now playing solo
});
```
## `unsetPartSoloMode({ partUuid: string }): Promise<void, Error>`
Disable the solo mode for a part
```js
embed.unsetPartSoloMode({ partUuid: 'c86be847-a7a1-54fb-44fc-a6564d7eb75c' }).then(function () {
// All the parts are now playing
});
```
### `getPartSoloMode({ partUuid: string }): Promise<Boolean, Error>`
Get the state of the solo mode of a part (`partUuid` can be retrieved with `getParts`)
```js
embed.getPartSoloMode({ partUuid: 'c86be847-a7a1-54fb-44fc-a6564d7eb75c' }).then(function (isSolo) {
// The solo state
console.log(isSolo);
});
```
### `getPartReverb({ partUuid: string }): Promise<Number, Error>`
Get a part reverberation (`partUuid` can be retrieved with `getParts`)
```js
embed.getPartReverb({ partUuid: 'c86be847-a7a1-54fb-44fc-a6564d7eb75c' }).then(function (reverb) {
// The reverberation value
console.log(reverb);
});
```
### `setPartReverb({ partUuid: string, reverberation: number }): Promise<void, Error>`
Set a part reverberation (`reverberation` between 0 and 100, `partUuid` can be retrieved with `getParts`)
```js
embed.setPartReverb({ partUuid: 'c86be847-a7a1-54fb-44fc-a6564d7eb75c', reverberation: 50 }).then(function () {
// The reverberation is set
});
```
### `print(): Promise<void, Error>
Print the score

@@ -463,5 +593,5 @@

Unlike the web version on <https://flat.io>, the embed does't catch the focus. This avoids to mess with the parent window, and avoid the browser to do a forced scrolling to the embed iframe.
Unlike the web version on <https://flat.io>, the embed doesn't catch the focus. This avoids to mess with the parent window, and avoid the browser to do a forced scrolling to the embed iframe.
If the end-user's goal is the usage of the embed to play or write notation, you can use this method to set the focus on the score and allowing they to use the keyboard bindings.
If the end-users' goal is the usage of the embed to play or write notation, you can use this method to set the focus on the score and allowing them to use the keyboard bindings.

@@ -565,2 +695,83 @@ ```js

### `getMeasureDetails(): Promise(<object, Error>)`
Retrieve details about the current measure. You can listen to the [`measureDetails`](#event-measuredetails) event to get the same details returned every time the cursor is moved or the measure is modified.
```js
embed.getMeasureDetails().then(function (measure) {
// {
// "clef": {
// "sign": "G",
// "line": 2,
// "clef-octave-change": -1
// },
// "key": {
// "fifths": 0
// },
// "time": {
// "beats": 4,
// "beat-type": 4
// },
// "displayedTime": {
// "beats": 4,
// "beat-type": 4
// },
// "transpose": {
// "chromatic": "0"
// },
// "voicesData": {
// "voices": [
// 0
// ],
// "mainVoiceIdx": 0
// }
// }
});
```
### `getNoteDetails(): Promise(<object, Error>)`
Retrieve details about the current note. You can listen to the [`noteDetails`](#event-notedetails) event to get the same details returned every time the cursor is moved or the note is modified.
```js
embed.getNoteDetails().then(function (measure) {
// {
// "articulations": [],
// "classicHarmony": null,
// "dynamicStyle": null,
// "ghostNotes": [
// false
// ],
// "hammerOnPullOffs": [
// false
// ],
// "harmony": null,
// "hasArpeggio": false,
// "hasGlissando": false,
// "isChord": false,
// "isInSlur": false,
// "isRest": false,
// "isTied": false,
// "lines": [
// -2.5
// ],
// "lyrics": [],
// "nbDots": 0,
// "nbGraces": 0,
// "ornaments": [],
// "pitches": [
// {
// "step": "E",
// "octave": 2,
// "alter": 0
// }
// ],
// "technical": [],
// "tupletType": null,
// "wedgeType": null,
// "durationType": "eighth"
// }
});
```
## Editor API

@@ -583,3 +794,3 @@

Events are broadcasted following actions made by the end user or you with the JavaScript API. You can subscribe to an event using the method [`on`](#onevent-string-callback-function-void), and unsubscribe using [`off`](#onevent-string-callback-function-void). When an event includes some data, this data will be available in the first parameter of the listener callback.
Events are broadcasted following actions made by the end-user or you with the JavaScript API. You can subscribe to an event using the method [`on`](#onevent-string-callback-function-void), and unsubscribe using [`off`](#onevent-string-callback-function-void). When an event includes some data, this data will be available in the first parameter of the listener callback.

@@ -604,2 +815,107 @@ ### Event: `scoreLoaded`

### Event: `cursorContext`
This event is triggered when the position or context of the user's cursor changes.
```json
{
"isRest": false,
"isGrace": false,
"isUnpitchedPart": false,
"isPitchedPart": true,
"isPitched": true,
"isChord": true,
"isTab": false,
"hasTab": true,
"hasTabFrame": false,
"isEndOfScore": false,
"isSameLineThanNextNote": false,
"hasSlashInConnection": false,
"canTieWithNextNote": false,
"canSwitchEnharmonic": false,
"isNextRest": false,
"hasTie": false,
"isHeadTied": false
}
```
### Event: `measureDetails`
This event is triggered when the position or context of the user's cursor changes.
The payload of this event is the same as the returned value from [`getMeasureDetails`](#getmeasuredetails-promiseobject-error).
```json
{
"clef": {
"sign": "G",
"line": 2,
"clef-octave-change": -1
},
"key": {
"fifths": 0
},
"time": {
"beats": 4,
"beat-type": 4
},
"displayedTime": {
"beats": 4,
"beat-type": 4
},
"transpose": {
"chromatic": "0"
},
"voicesData": {
"voices": [
0
],
"mainVoiceIdx": 0
}
}
```
### Event: `noteDetails`
This event is triggered when the position or context of the user's cursor changes.
The payload of this event is the same as the returned value from [`getNoteDetails`](#getnotedetails-promiseobject-error).
```json
{
"articulations": [],
"classicHarmony": null,
"dynamicStyle": null,
"ghostNotes": [
false
],
"hammerOnPullOffs": [
false
],
"harmony": null,
"hasArpeggio": false,
"hasGlissando": false,
"isChord": false,
"isInSlur": false,
"isRest": false,
"isTied": false,
"lines": [
-2.5
],
"lyrics": [],
"nbDots": 0,
"nbGraces": 0,
"ornaments": [],
"pitches": [
{
"step": "E",
"octave": 2,
"alter": 0
}
],
"technical": [],
"tupletType": null,
"wedgeType": null,
"durationType": "eighth"
}
```
### Event: `rangeSelection`

@@ -606,0 +922,0 @@

@@ -298,2 +298,101 @@ import './lib/compatibility';

/**
* Get the current master volume
*
* @return {Promise}
*/
getMasterVolume() {
return this.call('getMasterVolume');
}
/**
* Get the current master volume
*
* @return {Promise}
*/
setMasterVolume(parameters) {
return this.call('getMasterVolume', parameters);
}
/**
* Get the volume of a part
*
* @return {Promise}
*/
getPartVolume(parameters) {
return this.call('getPartVolume', parameters);
}
/**
* Set the volume of a part
*
* @return {Promise}
*/
setPartVolume(parameters) {
return this.call('setPartVolume', parameters);
}
/**
* Mute a part
*
* @return {Promise}
*/
mutePart(parameters) {
return this.call('mutePart', parameters);
}
/**
* Mute a part
*
* @return {Promise}
*/
unmutePart(parameters) {
return this.call('unmutePart', parameters);
}
/**
* Enable the solo mode for a part
*
* @return {Promise}
*/
setPartSoloMode(parameters) {
return this.call('setPartSoloMode', parameters);
}
/**
* Disable the solo mode for a part
*
* @return {Promise}
*/
unsetPartSoloMode(parameters) {
return this.call('unsetPartSoloMode', parameters);
}
/**
* Get the state of the solo mode of a part
*
* @return {Promise}
*/
getPartSoloMode(parameters) {
return this.call('getPartSoloMode', parameters);
}
/**
* Get the volume of a part
*
* @return {Promise}
*/
getPartReverb(parameters) {
return this.call('getPartReverb', parameters);
}
/**
* Set the volume of a part
*
* @return {Promise}
*/
setPartReverb(parameters) {
return this.call('setPartReverb', parameters);
}
/**
* Print the score

@@ -408,4 +507,24 @@ *

}
/**
* Get all the parts information
*
* @return {Promise}
* @fullfill {array} List of the parts
*/
getMeasureDetails() {
return this.call('getMeasureDetails');
}
/**
* Get all the parts information
*
* @return {Promise}
* @fullfill {array} List of the parts
*/
getNoteDetails() {
return this.call('getNoteDetails');
}
}
export default Embed;

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc