Comments (2)
Moving to ES modules has made this even harder. It seems that browsers won't import ES modules from anywhere other than the the host of the web page doing the import.
I think Rollup https://rollupjs.org/ might make it fairly easy to generate a simple javascript file that could be referenced from within a browser. It goes against my current objective of reducing 3rd party dependencies, but it looks pretty simple to use.
Perhaps we could start hosting rollup'd files on jsqubits github pages 🤔
from jsqubits.
Rollup worked great in my case, thanks for pointing me to that. With that it even works locally and older browers, no issues with CORS anymore. And it's super simple to use: first install rollup (if you are using nix, it's just nix-shell -p nodePackages.rollup
) and run:
$ rollup lib/index.js --file bundleJsqubit.js --format iife --name bundleJsqubit
Then to use it in a project:
<script src="./bundleJsqubit.js"></script>
<script type="text/javascript">
jsqubits = bundleJsqubit.jsqubits; //
var bell_pair = jsqubits('|00>').hadamard(0).controlledX(0,1);
</script>
from jsqubits.
Related Issues (20)
- Document the maths functions
- Fix exceptions to follow a more standard pattern HOT 1
- Allow array of bits anywhere we currently allow a bit range
- Include a 'remainingQbits' field on measurement outcomes.
- Support Complex.getPhase() HOT 1
- QState.eql uses non existent field amplitudes HOT 1
- Make use of js Math constants like Math.SQRT1_2 HOT 1
- Make jsqubits and jsqubitsmath be requirejs friendly
- Improve the objects returned by each() HOT 1
- Fix or remove usages of typeof and instanceof HOT 1
- How about refactor the project to ES6? HOT 1
- Examples don't run out of the box. HOT 5
- Publish new npm version HOT 3
- Decide what to do about bower support HOT 1
- dist/commonjs/index.js not found HOT 4
- Update Babel stuff HOT 1
- declaration for TypeScript HOT 8
- Measure and destroy a qubit HOT 4
- quantum gate conjugate
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from jsqubits.