Comments (3)
Two questions:
- What error(s) are you getting?
- Why is
kefir
listed as a global?
from kefir.
@mAAdhaTTah I listed kefir
as global because Rollup was complaining about unresolved dependencies and a missing global variable name, see output below:
> rollup -c
./src/main.js → dist/library.min.js...
(!) Unresolved dependencies
https://rollupjs.org/guide/en/#warning-treating-module-as-external-dependency
kefir (imported by src/main.js)
(!) Missing global variable name
Use output.globals to specify browser global variable names corresponding to external modules
kefir (guessing 'kefir')
created dist/library.min.js in 300ms
Adding or removing kefir
from rollup.config.js
globals didn't have any effect.
This is the code for my src/main.js
file:
// main.js
import { later } from 'kefir';
export default {
sayLater: (delay) => {
const interval = delay || 1000;
const stream = later(interval, 'hello world');
stream.log();
},
VERSION: Date.now()
};
I'm trying to load the library as follows:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title></title>
</head>
<body>
<script src="dist/library.min.js"></script>
<script>
window.onload = function () {
console.log(window.Library);
};
</script>
</body>
</html>
when trying to run this the later
method is undefined
:
{VERSION: 1582815560788, sayLater: ƒ}sayLater: ƒ sayLater(delay)VERSION: 1582815560788__proto__: Object
Library.sayLater()
main.js:6 Uncaught TypeError: Cannot read property 'later' of undefined
at Object.sayLater (main.js:6)
at <anonymous>:1:9
Any ideas on what I could be doing wrong?
from kefir.
You've configured Rollup to expect Kefir to be available as a global variable, so you need to make it available as such in order for this to work.
That said, this is a Rollup issues, and I'm not really a Rollup expert. I might suggest taking this question to StackOverflow or the Rollup issue tracker if you still have problems with this.
from kefir.
Related Issues (20)
- KefirJS and WebSockets HOT 4
- Only `sampledBy` is past tense
- Current state policies HOT 2
- Idea: Usable as AsycInterator
- Proposal to add `fromProperty` static function HOT 15
- Static Land interop `Observable` definition is wrong HOT 5
- Shouldn't a property only emit on "new values"? Proposing `onChange()` HOT 1
- Missing type for `unplug`
- Maintain TypeScript types? HOT 4
- Stop bundling `symbol-observable`
- TypeError: this._emitValue is not a function HOT 1
- Make subscription available inside callback HOT 8
- A big "Thank You" to Kefir developers HOT 1
- groupBy function HOT 8
- flatMapConcat should work when a spawned observable ends synchronously on activation
- Add documentation to "Kefir.pool" as "Rx.Subject equivalent" HOT 2
- Synchronous emit in flush method of debounce produces incorrect result HOT 8
- Is it possible to not activate a staled observable when reactivating flatMapLatest? HOT 8
- Russian docs translate
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 kefir.