cyclejs-ace-editor
Advanced tools
Comparing version
@@ -19,5 +19,5 @@ 'use strict'; | ||
var _apply_params = require('./apply_params'); | ||
var _apply_param = require('./apply_param'); | ||
var _apply_params2 = _interopRequireDefault(_apply_params); | ||
var _apply_param2 = _interopRequireDefault(_apply_param); | ||
@@ -45,3 +45,3 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
var flatParams$ = params$.concatMap(function (params) { | ||
var flatParams$ = (params$ || _rx.Observable.empty()).concatMap(function (params) { | ||
var keys = Object.keys(params); | ||
@@ -67,4 +67,16 @@ | ||
(0, _apply_params2.default)(editor$, params$).subscribe(); | ||
editor$.flatMap(function (editor) { | ||
return params$.map(function (config) { | ||
var key = config[0]; | ||
var value = config[1]; | ||
return { editor: editor, key: key, value: value }; | ||
}); | ||
}).subscribe(function (_ref3) { | ||
var editor = _ref3.editor; | ||
var key = _ref3.key; | ||
var value = _ref3.value; | ||
return (0, _apply_param2.default)(editor, key, value); | ||
}); | ||
var editorCode$ = editor$.map(function (editor) { | ||
@@ -71,0 +83,0 @@ var subject = new _rx.ReplaySubject(1); |
{ | ||
"name": "cyclejs-ace-editor", | ||
"version": "0.0.4", | ||
"version": "0.0.5", | ||
"description": "Cycle.js wrapper for the Ace Editor", | ||
"main": "lib/index.js", | ||
"scripts": { | ||
"test": "echo \"Error: no test specified\" && exit 1", | ||
"test": "karma start ./spec/karma.conf.js --single-run", | ||
"build": "babel src --out-dir lib", | ||
"build:example": "browserify example/src/index.js -t babelify --outfile example/index.js", | ||
"build:example": "browserify example/src/index.js -t babelify --outfile example/bundle.js", | ||
"deploy": "gulp deploy" | ||
@@ -34,5 +34,17 @@ }, | ||
"browserify": "^13.0.1", | ||
"chai": "^3.5.0", | ||
"gulp": "^3.9.1", | ||
"gulp-gh-pages": "^0.5.4" | ||
"gulp-gh-pages": "^0.5.4", | ||
"karma": "^1.1.0", | ||
"karma-browserify": "^5.0.5", | ||
"karma-chai": "^0.1.0", | ||
"karma-chai-sinon": "^0.1.5", | ||
"karma-mocha": "^1.1.1", | ||
"karma-mocha-reporter": "^2.0.4", | ||
"karma-phantomjs-launcher": "^1.0.1", | ||
"mocha": "^2.5.3", | ||
"phantomjs-prebuilt": "^2.1.7", | ||
"sinon": "^1.17.4", | ||
"sinon-chai": "^2.8.0" | ||
} | ||
} |
@@ -1,2 +0,2 @@ | ||
# cyclejs-ace-editor | ||
# cyclejs-ace-editor [](https://travis-ci.org/tommy-the-runner/cyclejs-ace-editor) | ||
@@ -45,8 +45,12 @@ Cycle.js intergration with [Ace Editor](https://ace.c9.io/) using | ||
// Import theme before we can use it | ||
import 'brace/theme/monokai' | ||
function main({DOM}) { | ||
const editorProps$ = Observable.of() | ||
const initialValue$ = Observable.just('Initial code') | ||
const params$ = Observable.just({ | ||
theme: 'ace/theme/monokai' | ||
}) | ||
const editor = AceEditor({DOM, params$, initialValue$}) | ||
const editor = AceEditor({DOM, params$: editorProps$, initialValue$}) | ||
return { | ||
@@ -53,0 +57,0 @@ DOM: Observable.combineLatest(editor.DOM, editor.value$.debounce(100), |
@@ -5,3 +5,3 @@ import {div, pre} from '@cycle/dom' | ||
import AceEditorWidget from './ace_editor_widget' | ||
import applyParams from './apply_params' | ||
import applyParam from './apply_param' | ||
@@ -21,8 +21,9 @@ var ace | ||
const flatParams$ = params$.concatMap(params => { | ||
const keys = Object.keys(params) | ||
const flatParams$ = (params$ || Observable.empty()) | ||
.concatMap(params => { | ||
const keys = Object.keys(params) | ||
const paramsArray = keys.map(key => [key, params[key]]) | ||
return Observable.from(paramsArray) | ||
}) | ||
const paramsArray = keys.map(key => [key, params[key]]) | ||
return Observable.from(paramsArray) | ||
}) | ||
@@ -37,4 +38,14 @@ return { | ||
function model({editor$, initialValue$, params$}) { | ||
applyParams(editor$, params$).subscribe() | ||
editor$ | ||
.flatMap(editor => { | ||
return params$.map((config) => { | ||
const key = config[0] | ||
const value = config[1] | ||
return {editor, key, value} | ||
}) | ||
}) | ||
.subscribe(({editor, key, value}) => applyParam(editor, key, value)) | ||
const editorCode$ = editor$ | ||
@@ -41,0 +52,0 @@ .map(editor => { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
No tests
QualityPackage does not have any tests. This is a strong signal of a poorly maintained or low quality package.
Found 1 instance in 1 package
65019
11.32%19
5.56%376
1.35%1
-50%72
5.88%19
171.43%