mirror of
https://github.com/wekan/wekan.git
synced 2025-12-21 18:00:12 +01:00
Fixed Non-ASCII attachment filename will crash when downloading.
Thanks to xet7 ! Fixes #2759
This commit is contained in:
parent
843ff8eaaa
commit
c2da477735
277 changed files with 30568 additions and 52 deletions
18
packages/wekan-cfs-reactive-property/.editorconfig
Normal file
18
packages/wekan-cfs-reactive-property/.editorconfig
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
# .editorconfig
|
||||
# Meteor adapted EditorConfig, http://EditorConfig.org
|
||||
# By RaiX 2013
|
||||
|
||||
root = true
|
||||
|
||||
[*.js]
|
||||
end_of_line = lf
|
||||
insert_final_newline = true
|
||||
indent_style = space
|
||||
indent_size = 2
|
||||
trim_trailing_whitespace = true
|
||||
charset = utf-8
|
||||
max_line_length = 80
|
||||
indent_brace_style = 1TBS
|
||||
spaces_around_operators = true
|
||||
quote_type = auto
|
||||
# curly_bracket_next_line = true
|
||||
2
packages/wekan-cfs-reactive-property/.gitignore
vendored
Normal file
2
packages/wekan-cfs-reactive-property/.gitignore
vendored
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
/versions.json
|
||||
.build*
|
||||
97
packages/wekan-cfs-reactive-property/.jshintrc
Normal file
97
packages/wekan-cfs-reactive-property/.jshintrc
Normal file
|
|
@ -0,0 +1,97 @@
|
|||
{
|
||||
// JSHint Meteor Configuration File
|
||||
// Match the Meteor Style Guide
|
||||
//
|
||||
// By @raix with contributions from @aldeed and @awatson1978
|
||||
// Source https://github.com/raix/Meteor-jshintrc
|
||||
//
|
||||
// See http://jshint.com/docs/ for more details
|
||||
|
||||
"maxerr": 50,
|
||||
"bitwise": true,
|
||||
"camelcase": true,
|
||||
"curly": true,
|
||||
"eqeqeq": true,
|
||||
"forin": true,
|
||||
"immed": false,
|
||||
"indent": 2,
|
||||
"latedef": false,
|
||||
"newcap": false,
|
||||
"noarg": true,
|
||||
"noempty": true,
|
||||
"nonew": false,
|
||||
"plusplus": false,
|
||||
"quotmark": false,
|
||||
"undef": true,
|
||||
"unused": true,
|
||||
"strict": true,
|
||||
"trailing": true,
|
||||
"maxparams": false,
|
||||
"maxdepth": false,
|
||||
"maxstatements": false,
|
||||
"maxcomplexity": false,
|
||||
"maxlen": 80,
|
||||
"asi": false,
|
||||
"boss": false,
|
||||
"debug": false,
|
||||
"eqnull": false,
|
||||
"es5": false,
|
||||
"esnext": false,
|
||||
"moz": false,
|
||||
"evil": false,
|
||||
"expr": false,
|
||||
"funcscope": false,
|
||||
"globalstrict": true,
|
||||
"iterator": false,
|
||||
"lastsemic": false,
|
||||
"laxbreak": false,
|
||||
"laxcomma": false,
|
||||
"loopfunc": false,
|
||||
"multistr": false,
|
||||
"proto": false,
|
||||
"scripturl": false,
|
||||
"smarttabs": false,
|
||||
"shadow": false,
|
||||
"sub": false,
|
||||
"supernew": false,
|
||||
"validthis": false,
|
||||
"browser": true,
|
||||
"couch": false,
|
||||
"devel": true,
|
||||
"dojo": false,
|
||||
"jquery": false,
|
||||
"mootools": false,
|
||||
"node": false,
|
||||
"nonstandard": false,
|
||||
"prototypejs": false,
|
||||
"rhino": false,
|
||||
"worker": false,
|
||||
"wsh": false,
|
||||
"yui": false,
|
||||
"nomen": false,
|
||||
"onevar": false,
|
||||
"passfail": false,
|
||||
"white": false,
|
||||
"predef": [
|
||||
"Meteor",
|
||||
"Accounts",
|
||||
"Session",
|
||||
"Template",
|
||||
"check",
|
||||
"Match",
|
||||
"Deps",
|
||||
"EJSON",
|
||||
"Email",
|
||||
"Package",
|
||||
"Tinytest",
|
||||
"Npm",
|
||||
"Assets",
|
||||
"Packages",
|
||||
"process",
|
||||
"LocalCollection",
|
||||
"_",
|
||||
"Random",
|
||||
"HTTP",
|
||||
"_methodHTTP"
|
||||
]
|
||||
}
|
||||
20
packages/wekan-cfs-reactive-property/LICENSE.md
Normal file
20
packages/wekan-cfs-reactive-property/LICENSE.md
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2013 [@raix](https://github.com/raix), aka Morten N.O. Nørgaard Henriksen, mh@gi-software.com
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
this software and associated documentation files (the "Software"), to deal in
|
||||
the Software without restriction, including without limitation the rights to
|
||||
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||
the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
32
packages/wekan-cfs-reactive-property/README.md
Normal file
32
packages/wekan-cfs-reactive-property/README.md
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
wekan-cfs-reactive-property [](https://travis-ci.org/CollectionFS/Meteor-reactive-property)
|
||||
=========
|
||||
|
||||
~~Looking for maintainers - please reach out!~~
|
||||
This package is to be archived due to inability to find contributors, thanks to everyone who helped make it possible.
|
||||
|
||||
**If you're looking for an alternative, we highly recommend [Meteor-Files](https://github.com/VeliovGroup/Meteor-Files) by [VeliovGroup](https://github.com/VeliovGroup)**
|
||||
|
||||
---
|
||||
|
||||
ReactiveProperty:
|
||||
* `get` Get value
|
||||
* `set` Set value
|
||||
* `getset` A combined getter and setter
|
||||
* `inc` Increase numeric values
|
||||
* `dec` Decrease numeric values
|
||||
|
||||
And... It's powered by Meteor's reactive sugar :)
|
||||
|
||||
Kind regards Eric(@aldeed) and Morten(@raix)
|
||||
|
||||
Happy coding!!
|
||||
|
||||
#API
|
||||
[API Documentation](api.md)
|
||||
|
||||
#Contribute
|
||||
[API Complete Documentation](internal.api.md)
|
||||
Update docs, `npm install docmeteor`
|
||||
```bash
|
||||
$ docmeteor
|
||||
```
|
||||
152
packages/wekan-cfs-reactive-property/api.md
Normal file
152
packages/wekan-cfs-reactive-property/api.md
Normal file
|
|
@ -0,0 +1,152 @@
|
|||
#ReactiveProperty
|
||||
A simple class that provides an reactive property interface
|
||||
|
||||
#### <a name="ReactiveProperty"></a>new ReactiveProperty(defaultValue, [reactive]) <sub><i>Anywhere</i></sub> ####
|
||||
-
|
||||
|
||||
__Arguments__
|
||||
|
||||
* __defaultValue__ *{any}*
|
||||
Set the default value for the reactive property
|
||||
* __reactive__ *{boolean}* (Optional = true)
|
||||
Allow the user to disable reactivity
|
||||
|
||||
-
|
||||
|
||||
|
||||
This api should only be in the internal.api.md
|
||||
|
||||
> ```ReactiveProperty = function(defaultValue, reactive) { ...``` [reactive-property.js:18](reactive-property.js#L18)
|
||||
|
||||
-
|
||||
|
||||
#### <a name="ReactiveProperty.get"></a>ReactiveProperty.get() <sub><i>Anywhere</i></sub> ####
|
||||
-
|
||||
*This method __get__ is defined in `ReactiveProperty`*
|
||||
|
||||
Usage:
|
||||
```js
|
||||
var foo = new ReactiveProperty('bar');
|
||||
foo.get(); // equals "bar"
|
||||
```
|
||||
|
||||
> ```self.get = function() { ...``` [reactive-property.js:44](reactive-property.js#L44)
|
||||
|
||||
-
|
||||
|
||||
#### <a name="ReactiveProperty.set"></a>ReactiveProperty.set(value) <sub><i>Anywhere</i></sub> ####
|
||||
-
|
||||
*This method __set__ is defined in `ReactiveProperty`*
|
||||
|
||||
__Arguments__
|
||||
|
||||
* __value__ *{any}*
|
||||
|
||||
-
|
||||
|
||||
Usage:
|
||||
```js
|
||||
var foo = new ReactiveProperty('bar');
|
||||
foo.set('bar');
|
||||
```
|
||||
|
||||
> ```self.set = function(value) { ...``` [reactive-property.js:58](reactive-property.js#L58)
|
||||
|
||||
-
|
||||
|
||||
#### <a name="ReactiveProperty.dec"></a>ReactiveProperty.dec([by]) <sub><i>Anywhere</i></sub> ####
|
||||
-
|
||||
*This method __dec__ is defined in `ReactiveProperty`*
|
||||
|
||||
__Arguments__
|
||||
|
||||
* __by__ *{number}* (Optional = 1)
|
||||
Value to decrease by
|
||||
|
||||
-
|
||||
|
||||
Usage:
|
||||
```js
|
||||
var foo = new ReactiveProperty('bar');
|
||||
foo.set(0);
|
||||
foo.dec(5); // -5
|
||||
```
|
||||
|
||||
> ```self.dec = function(by) { ...``` [reactive-property.js:75](reactive-property.js#L75)
|
||||
|
||||
-
|
||||
|
||||
#### <a name="ReactiveProperty.inc"></a>ReactiveProperty.inc([by]) <sub><i>Anywhere</i></sub> ####
|
||||
-
|
||||
*This method __inc__ is defined in `ReactiveProperty`*
|
||||
|
||||
__Arguments__
|
||||
|
||||
* __by__ *{number}* (Optional = 1)
|
||||
Value to increase by
|
||||
|
||||
-
|
||||
|
||||
Usage:
|
||||
```js
|
||||
var foo = new ReactiveProperty('bar');
|
||||
foo.set(0);
|
||||
foo.inc(5); // 5
|
||||
```
|
||||
|
||||
> ```self.inc = function(by) { ...``` [reactive-property.js:90](reactive-property.js#L90)
|
||||
|
||||
-
|
||||
|
||||
#### <a name="ReactiveProperty.getset"></a>ReactiveProperty.getset([value]) <sub><i>Anywhere</i></sub> ####
|
||||
-
|
||||
*This method __getset__ is defined in `ReactiveProperty`*
|
||||
|
||||
__Arguments__
|
||||
|
||||
* __value__ *{any}* (Optional)
|
||||
Value to set property - if undefined the act like `get`
|
||||
|
||||
-
|
||||
|
||||
__Returns__ *{any}*
|
||||
Returns value if no arguments are passed to the function
|
||||
|
||||
Usage:
|
||||
```js
|
||||
var foo = new ReactiveProperty('bar');
|
||||
foo.getset(5);
|
||||
foo.getset(); // returns 5
|
||||
```
|
||||
|
||||
> ```self.getset = function(value) { ...``` [reactive-property.js:106](reactive-property.js#L106)
|
||||
|
||||
-
|
||||
|
||||
#### <a name="ReactiveProperty.toString"></a>ReactiveProperty.toString() <sub><i>Anywhere</i></sub> ####
|
||||
-
|
||||
*This method __toString__ is defined in `ReactiveProperty`*
|
||||
|
||||
Usage:
|
||||
```js
|
||||
var foo = new ReactiveProperty('bar');
|
||||
foo.toString(); // returns 'bar'
|
||||
```
|
||||
|
||||
> ```self.toString = function() { ...``` [reactive-property.js:122](reactive-property.js#L122)
|
||||
|
||||
-
|
||||
|
||||
#### <a name="ReactiveProperty.toText"></a>ReactiveProperty.toText() <sub><i>Anywhere</i></sub> ####
|
||||
-
|
||||
*This method __toText__ is defined in `ReactiveProperty`*
|
||||
|
||||
Usage:
|
||||
```js
|
||||
var foo = new ReactiveProperty('bar');
|
||||
foo.toText(); // returns 'bar'
|
||||
```
|
||||
|
||||
> ```self.toText = self.toString;``` [reactive-property.js:135](reactive-property.js#L135)
|
||||
|
||||
-
|
||||
167
packages/wekan-cfs-reactive-property/internal.api.md
Normal file
167
packages/wekan-cfs-reactive-property/internal.api.md
Normal file
|
|
@ -0,0 +1,167 @@
|
|||
> File: ["reactive-property.js"](reactive-property.js)
|
||||
> Where: {client|server}
|
||||
|
||||
-
|
||||
#ReactiveProperty
|
||||
A simple class that provides an reactive property interface
|
||||
|
||||
#### <a name="ReactiveProperty"></a>new ReactiveProperty(defaultValue, [reactive]) <sub><i>Anywhere</i></sub> ####
|
||||
-
|
||||
|
||||
__Arguments__
|
||||
|
||||
* __defaultValue__ *{any}*
|
||||
Set the default value for the reactive property
|
||||
* __reactive__ *{boolean}* (Optional = true)
|
||||
Allow the user to disable reactivity
|
||||
|
||||
-
|
||||
|
||||
|
||||
This api should only be in the internal.api.md
|
||||
|
||||
> ```ReactiveProperty = function(defaultValue, reactive) { ...``` [reactive-property.js:18](reactive-property.js#L18)
|
||||
|
||||
-
|
||||
|
||||
#### <a name="ReactiveProperty.value"></a>ReactiveProperty.value {any} <sub><i>Anywhere</i></sub> ####
|
||||
-
|
||||
*This property is private*
|
||||
*This property __value__ is defined in `ReactiveProperty`*
|
||||
This contains the non reactive value, should only be used as a getter for
|
||||
internal use
|
||||
|
||||
> ```self.value = defaultValue;``` [reactive-property.js:27](reactive-property.js#L27)
|
||||
|
||||
-
|
||||
|
||||
#### <a name="ReactiveProperty.get"></a>ReactiveProperty.get() <sub><i>Anywhere</i></sub> ####
|
||||
-
|
||||
*This method __get__ is defined in `ReactiveProperty`*
|
||||
|
||||
Usage:
|
||||
```js
|
||||
var foo = new ReactiveProperty('bar');
|
||||
foo.get(); // equals "bar"
|
||||
```
|
||||
|
||||
> ```self.get = function() { ...``` [reactive-property.js:44](reactive-property.js#L44)
|
||||
|
||||
-
|
||||
|
||||
#### <a name="ReactiveProperty.set"></a>ReactiveProperty.set(value) <sub><i>Anywhere</i></sub> ####
|
||||
-
|
||||
*This method __set__ is defined in `ReactiveProperty`*
|
||||
|
||||
__Arguments__
|
||||
|
||||
* __value__ *{any}*
|
||||
|
||||
-
|
||||
|
||||
Usage:
|
||||
```js
|
||||
var foo = new ReactiveProperty('bar');
|
||||
foo.set('bar');
|
||||
```
|
||||
|
||||
> ```self.set = function(value) { ...``` [reactive-property.js:58](reactive-property.js#L58)
|
||||
|
||||
-
|
||||
|
||||
#### <a name="ReactiveProperty.dec"></a>ReactiveProperty.dec([by]) <sub><i>Anywhere</i></sub> ####
|
||||
-
|
||||
*This method __dec__ is defined in `ReactiveProperty`*
|
||||
|
||||
__Arguments__
|
||||
|
||||
* __by__ *{number}* (Optional = 1)
|
||||
Value to decrease by
|
||||
|
||||
-
|
||||
|
||||
Usage:
|
||||
```js
|
||||
var foo = new ReactiveProperty('bar');
|
||||
foo.set(0);
|
||||
foo.dec(5); // -5
|
||||
```
|
||||
|
||||
> ```self.dec = function(by) { ...``` [reactive-property.js:75](reactive-property.js#L75)
|
||||
|
||||
-
|
||||
|
||||
#### <a name="ReactiveProperty.inc"></a>ReactiveProperty.inc([by]) <sub><i>Anywhere</i></sub> ####
|
||||
-
|
||||
*This method __inc__ is defined in `ReactiveProperty`*
|
||||
|
||||
__Arguments__
|
||||
|
||||
* __by__ *{number}* (Optional = 1)
|
||||
Value to increase by
|
||||
|
||||
-
|
||||
|
||||
Usage:
|
||||
```js
|
||||
var foo = new ReactiveProperty('bar');
|
||||
foo.set(0);
|
||||
foo.inc(5); // 5
|
||||
```
|
||||
|
||||
> ```self.inc = function(by) { ...``` [reactive-property.js:90](reactive-property.js#L90)
|
||||
|
||||
-
|
||||
|
||||
#### <a name="ReactiveProperty.getset"></a>ReactiveProperty.getset([value]) <sub><i>Anywhere</i></sub> ####
|
||||
-
|
||||
*This method __getset__ is defined in `ReactiveProperty`*
|
||||
|
||||
__Arguments__
|
||||
|
||||
* __value__ *{any}* (Optional)
|
||||
Value to set property - if undefined the act like `get`
|
||||
|
||||
-
|
||||
|
||||
__Returns__ *{any}*
|
||||
Returns value if no arguments are passed to the function
|
||||
|
||||
Usage:
|
||||
```js
|
||||
var foo = new ReactiveProperty('bar');
|
||||
foo.getset(5);
|
||||
foo.getset(); // returns 5
|
||||
```
|
||||
|
||||
> ```self.getset = function(value) { ...``` [reactive-property.js:106](reactive-property.js#L106)
|
||||
|
||||
-
|
||||
|
||||
#### <a name="ReactiveProperty.toString"></a>ReactiveProperty.toString() <sub><i>Anywhere</i></sub> ####
|
||||
-
|
||||
*This method __toString__ is defined in `ReactiveProperty`*
|
||||
|
||||
Usage:
|
||||
```js
|
||||
var foo = new ReactiveProperty('bar');
|
||||
foo.toString(); // returns 'bar'
|
||||
```
|
||||
|
||||
> ```self.toString = function() { ...``` [reactive-property.js:122](reactive-property.js#L122)
|
||||
|
||||
-
|
||||
|
||||
#### <a name="ReactiveProperty.toText"></a>ReactiveProperty.toText() <sub><i>Anywhere</i></sub> ####
|
||||
-
|
||||
*This method __toText__ is defined in `ReactiveProperty`*
|
||||
|
||||
Usage:
|
||||
```js
|
||||
var foo = new ReactiveProperty('bar');
|
||||
foo.toText(); // returns 'bar'
|
||||
```
|
||||
|
||||
> ```self.toText = self.toString;``` [reactive-property.js:135](reactive-property.js#L135)
|
||||
|
||||
-
|
||||
23
packages/wekan-cfs-reactive-property/package.js
Normal file
23
packages/wekan-cfs-reactive-property/package.js
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
Package.describe({
|
||||
name: 'wekan-cfs-reactive-property',
|
||||
version: '0.0.4',
|
||||
summary: 'Reactive Property is a small, fast reative property class',
|
||||
git: 'https://github.com/zcfs/Meteor-reactive-property.git'
|
||||
});
|
||||
|
||||
Package.onUse(function (api) {
|
||||
api.versionsFrom('1.0');
|
||||
|
||||
api.use('deps', ['client', 'server']);
|
||||
|
||||
api.export('ReactiveProperty');
|
||||
api.addFiles(['reactive-property.js'], ['client', 'server']);
|
||||
});
|
||||
|
||||
// Package.onTest(function (api) {
|
||||
// api.use('power-queue');
|
||||
// api.use('test-helpers', 'server');
|
||||
// api.use('tinytest');
|
||||
|
||||
// api.add_files('tests.js');
|
||||
// });
|
||||
137
packages/wekan-cfs-reactive-property/reactive-property.js
Normal file
137
packages/wekan-cfs-reactive-property/reactive-property.js
Normal file
|
|
@ -0,0 +1,137 @@
|
|||
// #ReactiveProperty
|
||||
// A simple class that provides an reactive property interface
|
||||
|
||||
_noopCallback = function() {};
|
||||
|
||||
_nonReactive = {
|
||||
changed: _noopCallback,
|
||||
depend: _noopCallback
|
||||
};
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
* @param {any} defaultValue Set the default value for the reactive property
|
||||
* @param {boolean} [reactive = true] Allow the user to disable reactivity
|
||||
*
|
||||
* This api should only be in the internal.api.md
|
||||
*/
|
||||
ReactiveProperty = function(defaultValue, reactive) {
|
||||
var self = this;
|
||||
var _deps = (reactive === false)? _nonReactive : new Deps.Dependency();
|
||||
|
||||
/** @property ReactiveProperty.value
|
||||
* @private
|
||||
* This contains the non reactive value, should only be used as a getter for
|
||||
* internal use
|
||||
*/
|
||||
self.value = defaultValue;
|
||||
|
||||
self.onChange = function() {};
|
||||
|
||||
self.changed = function() {
|
||||
_deps.changed();
|
||||
self.onChange(self.value);
|
||||
};
|
||||
|
||||
/**
|
||||
* @method ReactiveProperty.get
|
||||
* Usage:
|
||||
* ```js
|
||||
* var foo = new ReactiveProperty('bar');
|
||||
* foo.get(); // equals "bar"
|
||||
* ```
|
||||
*/
|
||||
self.get = function() {
|
||||
_deps.depend();
|
||||
return self.value;
|
||||
};
|
||||
|
||||
/**
|
||||
* @method ReactiveProperty.set Set property to value
|
||||
* @param {any} value
|
||||
* Usage:
|
||||
* ```js
|
||||
* var foo = new ReactiveProperty('bar');
|
||||
* foo.set('bar');
|
||||
* ```
|
||||
*/
|
||||
self.set = function(value) {
|
||||
if (self.value !== value) {
|
||||
self.value = value;
|
||||
self.changed();
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* @method ReactiveProperty.dec Decrease numeric property
|
||||
* @param {number} [by=1] Value to decrease by
|
||||
* Usage:
|
||||
* ```js
|
||||
* var foo = new ReactiveProperty('bar');
|
||||
* foo.set(0);
|
||||
* foo.dec(5); // -5
|
||||
* ```
|
||||
*/
|
||||
self.dec = function(by) {
|
||||
self.value -= by || 1;
|
||||
self.changed();
|
||||
};
|
||||
|
||||
/**
|
||||
* @method ReactiveProperty.inc increase numeric property
|
||||
* @param {number} [by=1] Value to increase by
|
||||
* Usage:
|
||||
* ```js
|
||||
* var foo = new ReactiveProperty('bar');
|
||||
* foo.set(0);
|
||||
* foo.inc(5); // 5
|
||||
* ```
|
||||
*/
|
||||
self.inc = function(by) {
|
||||
self.value += by || 1;
|
||||
self.changed();
|
||||
};
|
||||
|
||||
/**
|
||||
* @method ReactiveProperty.getset increase numeric property
|
||||
* @param {any} [value] Value to set property - if undefined the act like `get`
|
||||
* @returns {any} Returns value if no arguments are passed to the function
|
||||
* Usage:
|
||||
* ```js
|
||||
* var foo = new ReactiveProperty('bar');
|
||||
* foo.getset(5);
|
||||
* foo.getset(); // returns 5
|
||||
* ```
|
||||
*/
|
||||
self.getset = function(value) {
|
||||
if (typeof value !== 'undefined') {
|
||||
self.set(value);
|
||||
} else {
|
||||
return self.get();
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* @method ReactiveProperty.toString
|
||||
* Usage:
|
||||
* ```js
|
||||
* var foo = new ReactiveProperty('bar');
|
||||
* foo.toString(); // returns 'bar'
|
||||
* ```
|
||||
*/
|
||||
self.toString = function() {
|
||||
var val = self.get();
|
||||
return val ? val.toString() : '';
|
||||
};
|
||||
|
||||
/**
|
||||
* @method ReactiveProperty.toText
|
||||
* Usage:
|
||||
* ```js
|
||||
* var foo = new ReactiveProperty('bar');
|
||||
* foo.toText(); // returns 'bar'
|
||||
* ```
|
||||
*/
|
||||
self.toText = self.toString;
|
||||
|
||||
};
|
||||
30
packages/wekan-cfs-reactive-property/tests.js
Normal file
30
packages/wekan-cfs-reactive-property/tests.js
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
"use strict";
|
||||
|
||||
function equals(a, b) {
|
||||
return !!(JSON.stringify(a) === JSON.stringify(b));
|
||||
}
|
||||
|
||||
Tinytest.add('ReactiveProperty - test', function(test) {
|
||||
//TODO
|
||||
});
|
||||
|
||||
|
||||
//Test API:
|
||||
//test.isFalse(v, msg)
|
||||
//test.isTrue(v, msg)
|
||||
//test.equalactual, expected, message, not
|
||||
//test.length(obj, len)
|
||||
//test.include(s, v)
|
||||
//test.isNaN(v, msg)
|
||||
//test.isUndefined(v, msg)
|
||||
//test.isNotNull
|
||||
//test.isNull
|
||||
//test.throws(func)
|
||||
//test.instanceOf(obj, klass)
|
||||
//test.notEqual(actual, expected, message)
|
||||
//test.runId()
|
||||
//test.exception(exception)
|
||||
//test.expect_fail()
|
||||
//test.ok(doc)
|
||||
//test.fail(doc)
|
||||
//test.equal(a, b, msg)
|
||||
Loading…
Add table
Add a link
Reference in a new issue