TODO
- 加入测试
- 纠正subject被观察对象模型, 现在的被观察对象的__value属性没有任何作用
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
{ | ||
// Use IntelliSense to learn about possible Node.js debug attributes. | ||
// Hover to view descriptions of existing attributes. | ||
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 | ||
"version": "0.2.0", | ||
"configurations": [ | ||
{ | ||
"type": "node", | ||
"request": "launch", | ||
"name": "启动程序", | ||
"program": "${workspaceRoot}\\index.js", | ||
"cwd": "${workspaceRoot}", | ||
"outFiles": [], | ||
"sourceMaps": true | ||
}, | ||
{ | ||
"type": "node", | ||
"request": "attach", | ||
"name": "附加到进程", | ||
"port": 5858, | ||
"outFiles": [], | ||
"sourceMaps": true | ||
} | ||
] | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
module.exports = require('./dist/index.js'); | ||
module.exports = require('./dist/ObservableAjax.js'); |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
let | ||
should = require('chai').should(), | ||
{default: ObservableAjax} = require('../dist/cjs/observableAjax.js'); | ||
|
||
describe('type check', function(){ | ||
describe('observableAjax.ajaxType', function(){ | ||
it(' should exist Net and Trans', function(){ | ||
// ObservableAjax.ajaxType; | ||
should.exist(ObservableAjax.ajaxType); | ||
should.exist(ObservableAjax.ajaxType.Net); | ||
should.exist(ObservableAjax.ajaxType.Trans); | ||
}); | ||
}); | ||
|
||
describe('observableAjax.eventType', function(){ | ||
it(' should exist updateStart and updateEnd and maybeNone and updateFailed', function(){ | ||
// ObservableAjax.ajaxType; | ||
should.exist(ObservableAjax.eventType); | ||
should.exist(ObservableAjax.eventType.updateStart); | ||
should.exist(ObservableAjax.eventType.updateEnd); | ||
should.exist(ObservableAjax.eventType.updateFailed); | ||
}); | ||
}); | ||
}) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,13 @@ | ||
let | ||
compiler = require('google-closure-compiler-js').compile, | ||
fs = require('fs'), | ||
sourceFile = fs.readFileSync('./dist/ObservableAjax.js', 'utf8'), | ||
sourceFile = fs.readFileSync('./dist/global/ObservableAjax.js', 'utf8'), | ||
compilerFlags = { | ||
jsCode: [{src: sourceFile}], | ||
languageIn: 'ES5', | ||
createSourceMap: true | ||
}, | ||
output = compiler(compilerFlags); | ||
|
||
fs.writeFileSync('./dist/ObservableAjax.min.js', output.compiledCode, 'utf-8'); | ||
fs.writeFileSync('./dist/ObservableAjax.min.js.map', output.srouceMap, 'utf-8'); | ||
fs.writeFileSync('./dist/global/ObservableAjax.min.js', output.compiledCode, 'utf-8'); | ||
fs.writeFileSync('./dist/global/ObservableAjax.min.js.map', output.srouceMap, 'utf-8'); |