1. narupo

    Posted

    narupo
Changes in title
+npm: browserify + jquery + jquery-drawer + iscroll: IScroll is not defined.
Changes in tags
Changes in body
Source | HTML | Preview
@@ -0,0 +1,35 @@
+環境は`npm` + `browserify`.
+`jquery-drawer`の導入で`iscroll`が必要になったが「IScroll is not defined」という例外が飛んできた。
+
+```js:
+var $ = require('jquery');
+require('jquery-drawer');
+var IScroll = require('iscroll')
+
+exports.parse = function(args) {
+ try {
+ $('.drawer').drawer();
+ } catch (e) {
+ alert('failed to parse drawer. ' + e);
+ }
+};
+
+```
+
+`var IScroll`を`IScroll`に変更したら動作した。おそらくスコープの関係?
+
+```js:
+var $ = require('jquery');
+require('jquery-drawer');
+IScroll = require('iscroll')
+
+exports.parse = function(args) {
+ try {
+ $('.drawer').drawer();
+ } catch (e) {
+ alert('failed to parse drawer. ' + e);
+ }
+};
+
+```
+