File tree 2 files changed +15
-7
lines changed
2 files changed +15
-7
lines changed Original file line number Diff line number Diff line change 1
- # jQueryのPlugin Pattern
1
+ # jQueryのPlugin
2
2
3
- !CODEFILE "../../src/jQuery/jquery.js"
3
+ jQueryでは ` $.fn ` を拡張する事で、 ` $() ` の返り値であるjQueryオブジェクトにメソッドを追加することが出来ます。
4
4
5
- ``` js
6
- var jQuery = require (" jquery" );
7
- jQuery (document .body );
8
- ```
5
+ 次の` greenify ` プラグインでは、` $(document.body).greenify(); ` というメソッド呼び出しが可能になります。
6
+
7
+ !CODEFILE "../../src/jQuery/greenify.js"
8
+
9
+ 実際に利用するためには、` jquery.js ` を読み込んだ後に` greenify.js ` を読み込ませる必要があります。
10
+
11
+ ``` html
12
+ <script src =" jquery.js" ></script >
13
+ <script src =" greenify.js" ></script >
14
+ ```
15
+
16
+ ## どういう仕組み?fea
Original file line number Diff line number Diff line change 1
1
// LICENSE : MIT
2
2
"use strict" ;
3
3
import jsdom from "jsdom" ;
4
- import assert from "power-assert"
4
+ import assert from "power-assert" ;
5
5
import fs from "fs" ;
6
6
const testbed = fs . readFileSync ( __dirname + "/fixtures/testbed.html" , "utf-8" ) ;
7
7
const jquery = fs . readFileSync ( __dirname + "/../../node_modules/jquery/dist/jquery.js" , "utf-8" ) ;
You can’t perform that action at this time.
0 commit comments