Skip to content

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

Merged
merged 26 commits into from
Sep 7, 2018
Merged

Conversation

indifferentghost
Copy link
Contributor

@indifferentghost indifferentghost commented Sep 5, 2018

This further fixes the following issues in #362.

can-define.types.serialize.html

  • Boolean should have an example to go along with it
  • Use examples should be codepen-able and relevant examples.
  • The first example in Use probably doesn't work since 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

  • Codepen-able run-able examples
  • compute is undefined under Use Working with the 'compute' type. After some research it seems compute may be depreciated its documentation is under legacy. import { compute } from "//unpkg.com/can@5/legacy.js"; doesn't import stating Uncaught 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

  • value( prop )'s first example should be codepen-able
  • The Returns subheading under value( prop ) example should be codepen-able and loggable.
  • Both examples under Use should be codepen-able and loggable.

@indifferentghost indifferentghost changed the title [DO NOT MERGE] 362 can define docs Improvements to Can-Define Documentation Sep 5, 2018
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
Copy link
Contributor

@justinbmeyer justinbmeyer Sep 5, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think indentation broke here. The code block should be indented.

image

Also notice how property and value are on the same line.

Copy link
Contributor

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
Copy link
Contributor

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.

} );

console.log( direction.serialize() ); //-> {
Copy link
Contributor

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{}

Copy link
Contributor Author

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");
Copy link
Contributor

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 = ...

@@ -202,8 +202,8 @@ const Paginate = DefineMap.extend( {
const p = new Paginate( { limit: 10, offset: 20 } );
p.set({ page: 13 });
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove the .set()


@signature `serialize( currentValue, propertyName )`

Specifies the serialized value of a property.
Specifies the serialized value of a property.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This indentation is causing:

image

Default: Person
}
}
```

@body

## Use

Copy link
Contributor

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.

Copy link
Contributor Author

@indifferentghost indifferentghost Sep 6, 2018

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 the Address constructor are being set as the default information in Direction instances.

@indifferentghost indifferentghost merged commit 9d0f619 into master Sep 7, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants