morse-pro | Understands prosigns | Audio Utils library
kandi X-RAY | morse-pro Summary
kandi X-RAY | morse-pro Summary
This Javascript (ES6) library is for manipulating Morse code text and sound. It is the library used in the tools on Stephen C Phillips's Morse code website. It has been written using ES6 (ECMA Script 6).
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of morse-pro
morse-pro Key Features
morse-pro Examples and Code Snippets
Community Discussions
Trending Discussions on morse-pro
QUESTION
I'm trying to use Swift's JavaScriptCore framework to take advantage of an existing JavaScript library that uses ES6 modules. Specifically, morse-pro by Stephen C Phillips. I've added the files to an Xcode playground, then used this code to load the library and run it in the JavaScript context:
...ANSWER
Answered 2018-Jan-25 at 09:27After much bumbling around in the dark, I found a way to make the library available to Swift without having to manually alter it.
First, as @estus suggested, I installed the library using NPM, which converts it to ES5 but does not resolve the dependencies. So it's still a bunch of separate files that call each other with require
and export
keywords that neither browsers nor JavaScriptCore understand.
Then I used Browserify to bundle all the dependencies into a single file so that JavaScriptCore could understand it. The normal operation of Browserify hides all the code, so I used the "--standalone" flag to tell it to make marked functions available. If you export the ES5 file directly, it creates a generic object and puts your exported functions under .default
. I want them slightly more accessible, so I created a new file to list the exports and then ran Browserify on that. So for example, a file called "morse-export.js" containing:
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install morse-pro
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page