Skip to content
This repository was archived by the owner on Nov 25, 2020. It is now read-only.

KDData: Proxy based realtime update object for kd.js #176

Merged
merged 22 commits into from
Aug 8, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
d673de1
KDData: Proxy based data object for realtime updates with kd/pistachio
gokmen Aug 4, 2017
df4ee33
KDObject: code tidy up, call super before setting up object properties
gokmen Aug 4, 2017
dad9dad
KDView: remove duplicate update handler, handled correctly in ::setData
gokmen Aug 4, 2017
67d004c
Add examples for kd.Data
gokmen Aug 4, 2017
f4153e6
Package: remove/ignore package-lock, remove wip methods of kd.Object
gokmen Aug 5, 2017
ee03bb4
KDData: move proxy eventemitter into __proxy__ and leave data as is
gokmen Aug 5, 2017
5912a33
Tests: KDData: initial tests
gokmen Aug 5, 2017
39f222d
KDObject: setOption return option value as before
gokmen Aug 5, 2017
7c974a6
KDData: from scratch, better and in a cleaner way with lots of fixes
gokmen Aug 5, 2017
af28551
KDView: setData: use KDData.getEmitter instead
gokmen Aug 5, 2017
22341b9
Tests: KDData: test case scenarios with all supported functionality
gokmen Aug 5, 2017
0276ee7
Code styling updates, cosmetic
gokmen Aug 5, 2017
8865654
Fix Button Components tests - mostly not called calledOnce methods
gokmen Aug 5, 2017
0ebfea5
Fix Input Components tests - mostly not called calledOnce methods
gokmen Aug 5, 2017
ff82d3d
Fix remaining components tests - mostly not called calledOnce methods
gokmen Aug 5, 2017
d32253a
Fix Core Components tests - mostly not called calledOnce methods
gokmen Aug 5, 2017
b25b7a2
Karma: add support for Firefox, Safari, Opera and PhantomJS on tests
gokmen Aug 7, 2017
d4d441f
KDWebCamView: fix tests for Firefox and skip on not supported platforms
gokmen Aug 7, 2017
7ffb603
KDFlexSplit: fix tests for PhantomJS
gokmen Aug 7, 2017
ced8736
Tests: Utils: fix test case for isTouchDevice method
gokmen Aug 7, 2017
ba58914
KDData: use Symbols for private keys, handle Proxy support
gokmen Aug 7, 2017
c959bbb
Update version: 1.2.0
gokmen Aug 8, 2017
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
node_modules
npm-debug.log
package-lock.json
build
.DS_Store
dist
Expand Down
10 changes: 10 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
dist: trusty
sudo: required

language: node_js
node_js:
- "6.10"
Expand All @@ -8,6 +11,13 @@ before_install:
install:
- npm install

addons:
apt:
sources:
- google-chrome
packages:
- google-chrome-stable

before_script:
- export CHROME_BIN=chromium-browser
- export DISPLAY=:99.0
Expand Down
132 changes: 0 additions & 132 deletions History.md

This file was deleted.

42 changes: 42 additions & 0 deletions examples/data/data.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
var code = `
// Create a new kd.Data with initial data
var date = new kd.Data({ now: new Date() })

// Create a view pistachio and the data created above
var main = new kd.View({ pistachio: "Now it's {strong{ #(now) }}, bye." }, date)

// Update the data every second
kd.utils.repeat(1000, () => date.now = new Date())

main.appendToDomBody()

`
eval(code)

new kd.CustomHTMLView({
tagName: 'pre',
partial: code,
}).appendToDomBody()

code = `
// Create a new kd.Data with initial data
var basket = new kd.Data([])

// Create a view pistachio and the data created above
var main = new kd.View({
pistachio: "I'll add an 🍎 into basket every 2 seconds. " +
"Now I've {strong{ #(length) }} 🍎 in the basket."
}, basket)

// Update the data every second
kd.utils.repeat(2000, () => basket.push('🍎'))

main.appendToDomBody()

`
eval(code)

new kd.CustomHTMLView({
tagName: 'pre',
partial: code,
}).appendToDomBody()
32 changes: 32 additions & 0 deletions examples/data/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>kd.js Examples - data</title>
<link rel="stylesheet" href="../kd.css">
<script src="../kd.js"></script>
<style type="text/css">
body {
margin: 0;
padding: 20px;
box-sizing: border-box;
width: 100%;
height: 100%;
font-family: Roboto, -apple-system, BlinkMacSystemFont, "Helvetica Neue", "Segoe UI", "Oxygen", "Ubuntu", "Cantarell", "Open Sans", sans-serif;
font-size: 18px;
line-height: 20px;
}
strong {
font-weight: bold;
}
pre {
font-family: monospace;
background: #EEE;
margin: 20px;
}
</style>
</head>
<body>
<script src="data.js"></script>
</body>
</html>
20 changes: 14 additions & 6 deletions gulpfile.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@ path = require 'path'

options = {
configFile: path.join __dirname, 'karma.conf.js'
singleRun: false
browsers: ['Chrome']
singleRun: true
coverageReporter: {
dir: 'coverage/'
type: 'html'
Expand All @@ -15,10 +14,19 @@ server = (options, done) ->
new karma.Server(options, done)

gulp.task 'test', (done) ->
server(options, done).start()

gulp.task 'travis-test', (done) ->
options.singleRun = true
options.coverageReporter.type = 'lcov'
options.browsers = ['Chrome_travis_ci']

if process.env.TRAVIS
options.browsers = [ 'Chrome_travis_ci', 'Firefox' , 'PhantomJS' ]

server(options, done).start()


gulp.task 'test-watch', (done) ->

options.singleRun = false
server(options, ->
done() if not doneBefore
doneBefore = yes
).start()
50 changes: 20 additions & 30 deletions karma.conf.js
Original file line number Diff line number Diff line change
@@ -1,31 +1,25 @@
// Karma configuration
// Generated on Wed Mar 19 2014 12:00:53 GMT-0700 (PDT)

var istanbul = require('browserify-istanbul');
var istanbul = require('browserify-istanbul')

module.exports = function(config) {
config.set({

// base path that will be used to resolve all patterns (eg. files, exclude)
basePath: '',


// frameworks to use
// available frameworks: https://npmjs.org/browse/keyword/karma-adapter
frameworks: ['mocha', 'browserify'],


// list of files / patterns to load in the browser
files: [
'lib/**/*.coffee',
'test/**/*.coffee'
],
files: ['lib/**/*.coffee', 'test/**/*.coffee'],

customLaunchers: {
Chrome_travis_ci: {
base: 'Chrome',
flags: ['--no-sandbox']
}
flags: ['--no-sandbox'],
},
},

// list of files to exclude
Expand Down Expand Up @@ -58,70 +52,66 @@ module.exports = function(config) {
'lib/components/autocomplete/simpleautocomplete.coffee',
],


// preprocess matching files before serving them to the browser
// available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor
preprocessors: {
'lib/**/*.coffee': ['browserify'],
'test/**/*.coffee': ['browserify']
'test/**/*.coffee': ['browserify'],
},


// test results reporter to use
// possible values: 'dots', 'progress'
// available reporters: https://npmjs.org/browse/keyword/karma-reporter
reporters: ['progress', 'coverage', 'coveralls'],


// web server port
port: 9876,


// enable / disable colors in the output (reporters and logs)
colors: true,


// level of logging
// possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG
logLevel: config.LOG_ERROR,


// enable / disable watching file and executing tests whenever any file changes
autoWatch: true,


// start these browsers
// available browser launchers: https://npmjs.org/browse/keyword/karma-launcher
browsers: ['Chrome'],

browsers: ['Chrome', 'Firefox', 'Opera', 'Safari', 'PhantomJS'],

// Continuous Integration mode
// if true, Karma captures browsers, runs the tests and exits
singleRun: false,

plugins : [
plugins: [
'karma-mocha',
'karma-coverage',
'karma-chrome-launcher',
'karma-safari-launcher',
'karma-firefox-launcher',
'karma-phantomjs-launcher',
'karma-opera-launcher',
'karma-browserify',
'karma-coveralls'
'karma-coveralls',
],

coverageReporter: {
dir : 'coverage/',
type: 'html'
dir: 'coverage/',
type: 'html',
},

browserify: {
transform: [
'coffeeify',
istanbul({
instrumenterConfig: { embedSource: true }
})
instrumenterConfig: { embedSource: true },
}),
],
extensions: ['.coffee']
extensions: ['.coffee'],
},

concurrency: 1
});
};
concurrency: 1,
})
}
Loading