-
Notifications
You must be signed in to change notification settings - Fork 7
Improvements to Can-Define Documentation #387
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
…-canDefineDocs
…-canDefineDocs
…eudo-vote from Kevin and Justin.
docs/value.md
Outdated
- __prop.lastSet__ `{can-simple-observable}` An observable value that gets set when this | ||
property is set. You can read its value or listen to when its value changes to | ||
derive the property value. The following makes `property` behave like a | ||
normal object property that can be get or set: | ||
|
||
```js |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it possible to codepen this?
docs/value.md
Outdated
``` | ||
<!-- @codepen --> | ||
@codepen |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This codepen should move (or create an additional) console.log()
in the setInterval
. Then, it should show unbinding from time
and that no more logs are printed.
docs/TypeConstructor.md
Outdated
} ); | ||
|
||
console.log( direction.serialize() ); //-> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These are addresses. We should make sure we show this. One way might be to write out:
console.log( direction.from )
Or maybe:
console.log( canReflect.getName(direction.from ) ) //-> Address{}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's worth noting: direction.from
outputs the entire constructor, the latter outputs "DefineMap{}"
.
I opted on console.log( direction.from instanceof Address ); //-> true
docs/type.md
Outdated
}); | ||
|
||
const p = new Person(); | ||
p.set("age", "25"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove the .set()
for .age = ...
docs/types.set.md
Outdated
@@ -202,8 +202,8 @@ const Paginate = DefineMap.extend( { | |||
const p = new Paginate( { limit: 10, offset: 20 } ); | |||
p.set({ page: 13 }); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove the .set()
docs/serialize.md
Outdated
|
||
@signature `serialize( currentValue, propertyName )` | ||
|
||
Specifies the serialized value of a property. | ||
Specifies the serialized value of a property. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Default: Person | ||
} | ||
} | ||
``` | ||
|
||
@body | ||
|
||
## Use | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add some text here about what the following example shows.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What would that text look like?
In the example below we can see that
value
properties from theAddress
constructor are being set as the default information inDirection
instances.
This further fixes the following issues in #362.
can-define.types.serialize.html
map
returns a new array based on returned values in the callback. (If map works differently here there should be a link to that map).can-define.types.type.html
import { compute } from "//unpkg.com/can@5/legacy.js";
doesn't import statingUncaught TypeError: Failed to resolve module specifier "can-compute". Relative references must start with either "/", "./", or "../".
-- was fixed by deleting the section!can-define.types.value.html