Skip to content
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

Finish implementing APIs for Chrome #63

Merged
merged 15 commits into from
Oct 20, 2015
Merged

Finish implementing APIs for Chrome #63

merged 15 commits into from
Oct 20, 2015

Conversation

appden
Copy link
Contributor

@appden appden commented Oct 15, 2015

No description provided.


// TODO: DATA
rpc.registerTypeConverter(types.DATE, (_, info) => new Date(info.value));
rpc.registerTypeConverter(types.LIST, lists.create);
rpc.registerTypeConverter(types.OBJECT, objects.create);
rpc.registerTypeConverter('ObjectTypesNOTIFICATION', notifications.create);
Copy link
Contributor

Choose a reason for hiding this comment

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

We should make a static string for ObjectTypes

@alazier
Copy link
Contributor

alazier commented Oct 15, 2015

Looks good.

exports.create = create;

function create(realmId, info) {
let notification = new Notification();
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this a class for the sake of consistency, or is there a type check somewhere? Otherwise, couldn't it just be

return { realmKey: realmId, idKey: info.id };

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 a class because technically it should have a constructor named Notification, which currently does nothing, but will have methods added in the near future. 😄

Since notifications are called synchronously after a write, we fake it by calling them manually for now. The future plan will be more involved, so some of that is stubbed out.
Which only consists of sortByProperty
@@ -1,63 +1,40 @@
'use strict';

let keys = require('./keys');
Copy link
Contributor

Choose a reason for hiding this comment

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

Its really annoying to have files for every reused object. make these a property on an existing object if possible

@alazier alazier changed the title Finish implementing APIs for Chrome [WIP] Finish implementing APIs for Chrome Oct 19, 2015
@@ -55,9 +60,24 @@ - (instancetype)init {
if (self) {
_context = JSGlobalContextCreate(NULL);

// JavaScriptCore crashes when trying to walk up the native stack to print the stacktrace.
// FIXME: Avoid having to do this!
static void (*setIncludesNativeCallStack)(JSGlobalContextRef, bool) = (void (*)(JSGlobalContextRef, bool))dlsym(RTLD_DEFAULT, "JSGlobalContextSetIncludesNativeCallStackWhenReportingExceptions");
Copy link
Contributor

Choose a reason for hiding this comment

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

Don't think we should be using private methods here. What happens if we don't do this?

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 crashes hard whenever any of our methods or property getter/setters throw an exception. Probably due to JavaScriptCore not supporting C++ lambdas. I agree with your sentiment, but that's why I left a FIXME. I think if we switch to regular functions from lambdas we won't need this, and I thought we'd probably do that when refactoring this file away from Objective-C.

@alazier
Copy link
Contributor

alazier commented Oct 20, 2015

Lets make issues for any remaining items and get this merged.

@appden appden changed the title [WIP] Finish implementing APIs for Chrome Finish implementing APIs for Chrome Oct 20, 2015
appden added a commit that referenced this pull request Oct 20, 2015
Finish implementing APIs for Chrome
@appden appden merged commit b98e89d into master Oct 20, 2015
@appden appden deleted the sk-chrome-apis branch October 20, 2015 08:24
alazier added a commit that referenced this pull request May 5, 2016
Optional property bug fixe/case insensitive queries
alazier pushed a commit that referenced this pull request Sep 14, 2016
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 17, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants